email_test.go 658 B

123456789101112131415161718192021
  1. package email
  2. import (
  3. "net/smtp"
  4. "testing"
  5. )
  6. func TestSend(t *testing.T) {
  7. // e := New("smtp.gmail.com:465")
  8. e := New("smtp.elasticemail.com:2525")
  9. // e.Auth = smtp.PlainAuth("", "vr@labstack.com", "Dream1980", "smtp.gmail.com")
  10. e.Auth = smtp.PlainAuth("", "vr@labstack.com", "54643b5b-3284-4f33-89bf-d228951c527f", "smtp.elasticemail.com")
  11. // err := smtp.SendMail("smtp.elasticemail.com:2525", e.Auth, "vr@labstack.com", []string{"ranavishal@gmail.com"}, []byte("body"))
  12. // fmt.Println(err)
  13. e.Send(&Message{
  14. From: "no-reply@labstack.com",
  15. To: "ranavishal@gmail.com",
  16. Subject: "test",
  17. Text: "xxxxxxxxxxxxxxxxxxxxxxxxxx",
  18. })
  19. }