-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented MIME multipart handling for alternative content
- Loading branch information
Showing
9 changed files
with
301 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ package main | |
import ( | ||
"fmt" | ||
"github.com/wneessen/go-mail" | ||
"io" | ||
"os" | ||
) | ||
|
||
|
@@ -12,8 +13,6 @@ func main() { | |
fmt.Printf("$TEST_HOST env variable cannot be empty\n") | ||
os.Exit(1) | ||
} | ||
tu := os.Getenv("TEST_USER") | ||
tp := os.Getenv("TEST_PASS") | ||
|
||
fa := "Winni Neessen <[email protected]>" | ||
toa := "Winfried Neessen <[email protected]>" | ||
|
@@ -37,6 +36,15 @@ func main() { | |
m.SetDate() | ||
m.SetBulk() | ||
|
||
m.SetBodyWriter(mail.TypeTextPlain, func(fw io.Writer) error { | ||
_, err := io.WriteString(fw, "This is a writer test") | ||
return err | ||
}) | ||
m.AddAlternativeString(mail.TypeTextHTML, "This is HTML content") | ||
//m.Write(os.Stdout) | ||
|
||
tu := os.Getenv("TEST_USER") | ||
tp := os.Getenv("TEST_PASS") | ||
c, err := mail.NewClient(th, mail.WithTLSPolicy(mail.TLSMandatory), | ||
mail.WithSMTPAuth(mail.SMTPAuthLogin), mail.WithUsername(tu), | ||
mail.WithPassword(tp)) | ||
|
@@ -48,4 +56,5 @@ func main() { | |
fmt.Printf("failed to dial: %s\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
module github.com/wneessen/go-mail | ||
|
||
go 1.17 | ||
|
||
require github.com/go-mail/mail/v2 v2.3.0 | ||
|
||
require ( | ||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect | ||
gopkg.in/mail.v2 v2.3.1 // indirect | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
github.com/go-mail/mail/v2 v2.3.0 h1:wha99yf2v3cpUzD1V9ujP404Jbw2uEvs+rBJybkdYcw= | ||
github.com/go-mail/mail/v2 v2.3.0/go.mod h1:oE2UK8qebZAjjV1ZYUpY7FPnbi/kIU53l1dmqPRb4go= | ||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc h1:2gGKlE2+asNV9m7xrywl36YYNnBG5ZQ0r/BOOxqPpmk= | ||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc/go.mod h1:m7x9LTH6d71AHyAX77c9yqWCCa3UKHcVEj9y7hAtKDk= | ||
gopkg.in/mail.v2 v2.3.1 h1:WYFn/oANrAGP2C0dcV6/pbkPzv8yGzqTjPmTeO7qoXk= | ||
gopkg.in/mail.v2 v2.3.1/go.mod h1:htwXN1Qh09vZJ1NVKxQqHPBaCBbzKhp5GzuJEA4VJWw= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.