无法从网络服务器发送 html 格式的电子邮件
您好,我正在开发一个电子邮件系统,该系统用于在用户在网站上注册时发送电子邮件。以纯文本格式发送的电子邮件可以正确发送,但以 html 格式发送时,即使脚本一切正常,也无法发送。当我使用 aol 或 gmail smtp 服务器发送它时,它甚至不起作用。我的网络服务器是否禁止以 html 格式发送电子邮件,或者还有其他问题吗?
Hi i am working on an email system which is used to send email when user is registered on the site. The email when sent in plain text format is delivered correctly but it fails to get delivered even when everything goes ok with the script when sent in html format. It doesn't even work when I use aol or gmail smtp server for sending it. Does my webserver bans email from sending in html format or there's any other problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与其说是服务器,不如说是电子邮件客户端。
根据您在 html 中使用的格式类型,电子邮件更有可能被电子邮件阅读器或某些垃圾邮件过滤器拒绝。
首先尝试发送包含两个部分的电子邮件 - 文本部分和 html 部分,但将 html 部分的格式保持在最低限度。 (即从不格式化开始。)然后慢慢增加格式化,看看它何时停止。例如,链接应该完全“直接” - 向用户显示链接中的所有内容 - 文本应该与 href 匹配。不允许使用按钮。
无论你做什么,html 电子邮件的过滤率总是比文本电子邮件更高,因此首先要仔细考虑 html 的使用。如果电子邮件没有送达,那么它再漂亮也无济于事。
Not so much the server, but probably the email client.
Depending on the sort of formatting you used in the html, it's far more likely for the email to be rejected by either the email reader, or some spam filter along the way.
First try sending the email including both parts - the text part and the html part, but keep the formatting in the html part to a bare minimum. (ie start with no formatting.) Then slowly increase the formatting to see when it stops. Links for example should be completely "straight" - show the user everything in the link - the text should match the href. Buttons are not allowed.
No mater what you do, html emails will always have a higher filter rate than text ones, so carefully consider the use of html in the first place. It doesn't matter how pretty the email is if it doesn't get delivered.