smtp_test.go 552 B

12345678910111213141516171819202122232425262728293031
  1. package mail
  2. import (
  3. // "os"
  4. "testing"
  5. )
  6. func TestSend(t *testing.T) {
  7. /*
  8. conf := &SMTPConfig{
  9. Username: "swh@adm***.com",
  10. Password: "",
  11. Host: "smtp.exmail.qq.com",
  12. Port: 465,
  13. Secure: "SSL",
  14. }
  15. c := NewSMTPClient(conf)
  16. m := NewMail()
  17. m.AddTo("brother <1556****@qq.com>")
  18. m.AddFrom("hank <" + conf.Username + ">")
  19. m.AddSubject("Testing")
  20. m.AddText("Some text :)")
  21. filepath, _ := os.Getwd()
  22. m.AddAttachment(filepath + "/README.md")
  23. if e := c.Send(m); e != nil {
  24. t.Error(e)
  25. } else {
  26. t.Log("发送成功")
  27. }
  28. */
  29. }