我可以在不定义用户名和密码的情况下将 SMTP 与 Swift Mailer 一起使用吗
我正在尝试使用 Swift Mailer 在她的网站上向客户发送电子邮件。问题是,我不知道她的用户名/密码电子邮件信息,而且我不想使用我的。
有没有办法将 SMTP 与 Swift Mailer 一起使用,而不定义用户名、密码或电子邮件主机?邮件功能将如何允许您使用任何内容作为收件人/发件人地址。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这就是我为我们的一个脚本所做的,我相信它正是这样做的。
这可能是从 Swift 邮件程序文档中复制粘贴并稍加修改的。我们所做的就是连接到本地主机上的 SMTP。
编辑:查看原始帖子的评论,我确实想知道是否会触发垃圾邮件过滤器。我们实际上并没有遇到任何问题...一个,也许两个用户抱怨没有收到电子邮件。如果有关于此类内容的任何好的文档以及避免这些问题的方法,我很乐意提供其链接。我想我们只是在我们的机器上运行了由我们的提供商设置的默认 IIS SMTP 服务器。
另一个编辑:啊,如果这是在其他人的网站上发生的,我们不知道他们到底是如何设置的。我想知道您是否可以在其他电子邮件提供商处创建一个帐户(假设这不违反他们的使用条款)。也许我的帖子太仓促了,抱歉。
This is what I have for one of our scripts and I believe it does exactly that.
This was probably copy-pasted and slightly modified from the Swift mailer documentation. All we're doing is connecting to SMTP on localhost.
Edit: Looking at comments on the original post, I do have to wonder about triggering spam filters. We haven't really had a problem with it... one, maybe two users have complained about not receiving e-mails. If there's any good documentation on this kind of stuff and ways to avoid these problems, I'd love to have a link to it. I think we just have the default IIS SMTP server running on our machine as set up by our provider.
Another Edit: Ah, if this is going on to someone else's website, we don't know exactly how they're set up. I wonder if you could create an account with some other e-mail provider (assuming it's not against their terms of use.) Maybe I jumped the gun with my post, sorry.
为了正确执行此操作,您必须使用真实的电子邮件地址并从正确配置的服务器发送。否则您的邮件将最终进入他们的垃圾邮件箱。
只需让您的客户设置一个名为 这会是为了这个。如果由于某种愚蠢的原因他们不能这样做,那么在 gmail 或其他一些免费电子邮件提供商处设置一个邮件地址,并通过他们的邮件服务器发送。
在当今世界,正确配置邮件服务器需要做很多工作。从黑名单管理、反向 DNS 配置、SPF 设置等。重点是提供商每天都变得越来越挑剔,如果您希望看到您的应用程序长期运行,那么您需要正确执行此操作。
希望有帮助。
In order to do this right you have to use a real email address and send it from a server that is properly configured. Otherwise your mail will end up in their spam box.
Just have your client set up an email address called [email protected] which would be for this. If for whatever silly reason they can't do that then set up a mail address at gmail or some other free email provider and send it through their mail server.
There is a LOT that goes into properly configuring a mail server in todays world. From blacklist management, reverse dns configuration, SPF setup, etc. Point is providers are getting more finicky every day and if you want to see your application work long term then you'll need to do this right.
Hope that helps.