Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: SMTP Compatibility Enhancement and SSL Protocol Support (#174) #213

Merged
merged 2 commits into from
Jun 23, 2024

Conversation

Sh1n3zZ
Copy link
Collaborator

@Sh1n3zZ Sh1n3zZ commented Jun 22, 2024

Dear @zmh-program ,

此 pr 中修复了原 issue (#174) 中提到的无法在 chatnio 中使用部分第三方 smtp 服务商的问题。经排查,其原因是由于部分服务商对 RFC5321MailFrom 支持仍存在部分问题(即只允许一个 Email 存在于 FromHeader 中)。同时 mail.v2 库中的 NewDialer 方法的入参依次应为 “主机”、“端口”、“用户名”、“密码” 而非 “主机”、“端口”、“发件人”、“密码” ;同时根据 #174 中的建议 #174 (comment) “添加更多自定义配置”,故决定将判断是否存在 @ 值的正则反过来,即输入中需要附带 @ 且不再判断 @ 后域是否与“发件域名”中的主域名一致。综以上两点,在新的 pr 中作出如下修改

dialer := mail.NewDialer(s.Host, s.Port, s.From, s.Password)
message.SetHeader("From", fmt.Sprintf("%s <%s>", s.Username, s.From))

修改为

dialer := mail.NewDialer(s.Host, s.Port, s.Username, s.Password)
message.SetHeader("From", s.From)

另:实现了 SMTP 的 TLS / SSL 协议切换,可根据需要自行选择

Best Regards,
Junhai Deng

Copy link

vercel bot commented Jun 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
chatnio ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 22, 2024 7:22pm

@Sh1n3zZ Sh1n3zZ mentioned this pull request Jun 22, 2024
@zmh-program
Copy link
Member

Great, 是否考虑到向下compatible?
@Sh1n3zZ

@Issues-translate-bot
Copy link

Bot detected the issue body's language is not English, translate it automatically.


Great, is downward compatible considered?
@Sh1n3zZ

@zmh-program zmh-program merged commit f08f442 into main Jun 23, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants