go-gomail / gomail

The best way to send emails in Go.
MIT License
4.33k stars 573 forks source link

Can not send email to stmp.qq.com #27

Closed bronze1man closed 9 years ago

bronze1man commented 9 years ago

I always get a EOF error. I have tcpdumped the traffic. The connect is reset when it using tls.

alexcesaro commented 9 years ago

Can you show your code? Have you tried this workaround: https://github.com/go-gomail/gomail#x509-certificate-signed-by-unknown-authority

bronze1man commented 9 years ago

I do not try that workaround.Thanks.

bronze1man commented 9 years ago

I have tried the workaround. It does not work. I looks like it is not an tls error. I first get 535 Authentication failed Then get EOF. The weird thing is that my password and username is currect.

alexcesaro commented 9 years ago

Is there an English documentation on how to send emails using QQ's SMTP?

You can also try to use the LOGIN mechanism: https://github.com/go-gomail/gomail#504-574-unrecognized-authentication-type

bronze1man commented 9 years ago

LOGIN mechanism does not work

func sendToQq()(err error){
    addr:="xxx@qq.com"
    msg := gomail.NewMessage()
    msg.SetHeader("From", addr)
    msg.SetHeader("To", addr)
    msg.SetHeader("Subject", "测试邮件1")
    msg.SetBody("text/html", "测试邮件2")

    auth := gomail.LoginAuth("xxx", "xxx", "smtp.qq.com")
    mailer := gomail.NewCustomMailer("smtp.qq.com:587", auth,gomail.SetTLSConfig(&tls.Config{InsecureSkipVerify: true}))

    //mailer:=gomail.NewMailer("smtp.qq.com","xxx","xxxx",587,
    //gomail.SetTLSConfig(&tls.Config{InsecureSkipVerify: true}))
    return mailer.Send(msg)
}

Here is the document http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=331. It says to use smtp.qq.com port 465 or 587 and ssl to send email. use imap.qq.com port 993 and ssl to recevie email. use your username without @qq.com as account name to login if you are not vip account.

bronze1man commented 9 years ago

I can not use it with my iphone either. I think it is qq's fault,it is not this library fault.

alexcesaro commented 9 years ago

Have you tried port 465?

bronze1man commented 9 years ago

It return a 535 Authentication failed again.

alexcesaro commented 9 years ago

Ok I guess you should contact QQ's support then.

bronze1man commented 9 years ago

Thanks for your time. it turn out that it is my fault. I should study it longer before ask it in the issue.

qishenonly commented 11 months ago

Thanks for your time.  it turn out that it is my fault. I should study it longer before ask it in the issue.

Hello, how did you resolve the EOF error returned by sending QQ emails? I have also encountered this issue recently

bronze1man commented 11 months ago

sorry i forgot. some tips: EOF means remote program close the connection . It maybe you protocol is not correct, you can use wireshark to verify it.

qishenonly commented 11 months ago

sorry i forgot.  some tips: EOF means remote program close the connection . It maybe you protocol is not correct, you can use wireshark to verify it.

Thank you very much for your prompt. I have solved this problem!