Comments (6)
You can already do it by using getSendMailFunc
and implementing your own email-sending function.
But I can also add new methods so you can do something like that:
c := mailer.Connect()
defer c.Close()
for _, msg := range list {
if err := c.Send(msg); err != nil {
panic(err)
}
}
Would that fits your need?
from gomail.
Sorry, I wasn't able to play with your library until now! :)
Yep, this would be a great addition to this package! I'll try to implement a custom email-sending function. Not sure when btw...
Thanks!!!
from gomail.
+1
from gomail.
I will do it for Gomail v2 (which should be released in August as Go 1.5). In the meantime you can already do it by implementing your own email-sending function and using SetSendMail
.
from gomail.
Gomail v2 will handle sending many mails on one connection. You can already try the unstable version and tell me if it is fine:
package main
import (
"fmt"
"gopkg.in/gomail.v2-unstable"
)
func main() {
messages := make([]*gomail.Message, 10)
for i := 0; i < len(messages); i++ {
m := gomail.NewMessage()
m.SetHeader("From", "[email protected]")
m.SetHeader("To", "[email protected]")
m.SetHeader("Subject", fmt.Sprintf("Test %d", i))
m.SetBody("text/html", fmt.Sprintf("Test %d", i))
messages[i] = m
}
d := gomail.NewPlainDialer("smtp.example.com", "user", "123456", 587)
if err := d.DialAndSend(messages...); err != nil {
panic(err)
}
}
from gomail.
Awesome! ๐
from gomail.
Related Issues (20)
- Attach PDF HOT 2
- Not receiving email when sending email as No SMTP. HOT 1
- Maintainer has left this world HOT 1
- How to set email importance and email-receipt? HOT 2
- How to download it? HOT 1
- How to send emails using SSL encryption or TLS encryption HOT 1
- Mail Delivery Subsystem Error HOT 2
- Could we add support to specifically unset/delete all attachements? HOT 2
- Where to Report Vulnerabilities? HOT 2
- Can not send email to stmp.163.com and stmp.qq.com
- Email content tampering vulnerability due to crafted file names
- [feature] Flag to ignore invalid address error HOT 2
- Email doesnt send if there is one of receipts address invalid HOT 4
- how to config ssl HOT 2
- Attachment issue HOT 1
- Export some neccessary types to read info HOT 1
- 550 Mailbox not found or access denied HOT 3
- how to set timeout when send HOT 2
- SCRAM-SHA-1(-PLUS) + SCRAM-SHA-256(-PLUS) + SCRAM-SHA-512(-PLUS) + SCRAM-SHA3-512(-PLUS) supports
- ะกould not send email if it have dot before @ in address HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gomail.