Made NewPlainDialer arguments order more intuitive

This commit is contained in:
Alexandre Cesaro 2015-08-23 18:54:21 +02:00
parent 809903b2a6
commit 1e43a4157e
3 changed files with 8 additions and 8 deletions

View File

@ -19,7 +19,7 @@ func Example() {
m.SetBody("text/html", "Hello <b>Bob</b> and <i>Cora</i>!")
m.Attach("/home/Alex/lolcat.jpg")
d := gomail.NewPlainDialer("smtp.example.com", "user", "123456", 587)
d := gomail.NewPlainDialer("smtp.example.com", 587, "user", "123456")
// Send the email to Bob, Cora and Dan
if err := d.DialAndSend(m); err != nil {
@ -32,7 +32,7 @@ func Example_daemon() {
ch := make(chan *gomail.Message)
go func() {
d := gomail.NewPlainDialer("smtp.example.com", "user", "123456", 587)
d := gomail.NewPlainDialer("smtp.example.com", 587, "user", "123456")
var s gomail.SendCloser
var err error
@ -79,7 +79,7 @@ func Example_newsletter() {
Address string
}
d := gomail.NewPlainDialer("smtp.example.com", "user", "123456", 587)
d := gomail.NewPlainDialer("smtp.example.com", 587, "user", "123456")
s, err := d.Dial()
if err != nil {
panic(err)

View File

@ -29,7 +29,7 @@ type Dialer struct {
// NewPlainDialer returns a Dialer. The given parameters are used to connect to
// the SMTP server via a PLAIN authentication mechanism. It fallbacks to the
// LOGIN mechanism if it is the only mechanism advertised by the server.
func NewPlainDialer(host, username, password string, port int) *Dialer {
func NewPlainDialer(host string, port int, username, password string) *Dialer {
return &Dialer{
Host: host,
Port: port,

View File

@ -21,7 +21,7 @@ var (
)
func TestDialer(t *testing.T) {
d := NewPlainDialer(testHost, "user", "pwd", testPort)
d := NewPlainDialer(testHost, testPort, "user", "pwd")
testSendMail(t, d, []string{
"Extension STARTTLS",
"StartTLS",
@ -39,7 +39,7 @@ func TestDialer(t *testing.T) {
}
func TestDialerSSL(t *testing.T) {
d := NewPlainDialer(testHost, "user", "pwd", testSSLPort)
d := NewPlainDialer(testHost, testSSLPort, "user", "pwd")
testSendMail(t, d, []string{
"Extension AUTH",
"Auth",
@ -55,7 +55,7 @@ func TestDialerSSL(t *testing.T) {
}
func TestDialerConfig(t *testing.T) {
d := NewPlainDialer(testHost, "user", "pwd", testPort)
d := NewPlainDialer(testHost, testPort, "user", "pwd")
d.TLSConfig = testConfig
testSendMail(t, d, []string{
"Extension STARTTLS",
@ -74,7 +74,7 @@ func TestDialerConfig(t *testing.T) {
}
func TestDialerSSLConfig(t *testing.T) {
d := NewPlainDialer(testHost, "user", "pwd", testSSLPort)
d := NewPlainDialer(testHost, testSSLPort, "user", "pwd")
d.TLSConfig = testConfig
testSendMail(t, d, []string{
"Extension AUTH",