diff --git a/example_test.go b/example_test.go
index 61a75ad..8efee89 100644
--- a/example_test.go
+++ b/example_test.go
@@ -19,7 +19,7 @@ func Example() {
m.SetBody("text/html", "Hello Bob and Cora!")
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)
diff --git a/smtp.go b/smtp.go
index 70fd36c..30bcb07 100644
--- a/smtp.go
+++ b/smtp.go
@@ -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,
diff --git a/smtp_test.go b/smtp_test.go
index c9b5e48..c850348 100644
--- a/smtp_test.go
+++ b/smtp_test.go
@@ -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",