https://github.com/stvoidit/gosmtp
Simple client implementation for sending emails with file attachments
https://github.com/stvoidit/gosmtp
golang smtp smtp-client smtplib
Last synced: 6 months ago
JSON representation
Simple client implementation for sending emails with file attachments
- Host: GitHub
- URL: https://github.com/stvoidit/gosmtp
- Owner: stvoidit
- License: mit
- Created: 2019-12-17T22:08:23.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-29T21:57:31.000Z (over 2 years ago)
- Last Synced: 2024-06-21T06:33:07.825Z (about 2 years ago)
- Topics: golang, smtp, smtp-client, smtplib
- Language: Go
- Homepage:
- Size: 24.4 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# gosmtp
### Usage example
func main() {
client := gosmtp.NewSender(
"admin1",
"sosecretpassword",
"admin1@example.com",
"smtp.example.com:465")
var recipients = [][]string{
{"user1@example.com", "user2@example.com"},
{"user3@example.com", "user4@example.com"},
}
var files = []string{
"file1.jpeg",
"file2.mp3",
}
for _, recs := range recipients {
var msg = gosmtp.NewMessage().
SetTO(recs...).
SetSubject("hello world").
SetText("something text").
AddAttaches(files...)
if err := client.SendMessage(msg); err != nil {
log.Fatalln(err)
}
}
}
Works with mail services:
* mail.yandex.ru
* e.mail.ru
* gmail.com
__TODO__:
* STARTTLS may be not worked. On outlook (smtp.office365.com:587) not work