Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 10 years ago.
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(7)
我在很多项目中使用过 PHPMailer,从来没有遇到过问题。 它的功能完整并且有很好的文档。
我从未听说过 Swiftmailer,所以我浏览了该网站。 这似乎也是一个不错的解决方案。
如果你的需求像你说的那么简单,那就随机选择一个吧。
I've used PHPMailer on many projects and never had a problem. It's feature complete and it has good docs.
I had never heard of Swiftmailer so I took a peek at the website. It seems a nice solution too.
If your needs are simple as you say, then just pick one at random.
Google 趋势:swiftmailer 正在增长,但 phpmailer 仍然非常强大。
我会选择 Swiftmailer,因为文档清晰且简单。 Phpmailer 网站/文档有点混乱(至少看起来如此)。
编辑:在尝试了它们之后(并且对 SwiftMailer 没有输出任何类型提示的托管问题进行了撞击)我完全改变了主意,我肯定会选择 PHPMailer 至少有一个好处原因:如果遇到任何问题,调试起来会容易得多。
SwiftMailer 和 PHPMailer 都提供了调试选项(带有插件的 SwiftMailer 和打开
SMTPDebug = 2
的 PHPMailer),但 SwiftMailer 由数百个小文件组成,这使得 SwiftMailer 与 3 个文件相比更难以调试PHPMailer 是由.关于文档, PHPmailer 文档 看起来不太花哨,但它有您所需要的一切:简单教程,示例
Google trends: swiftmailer is growing but phpmailer is still very strong.
I would go with Swiftmailer because documentation is clear and easy. Phpmailer site/docs are a bit messy (at least they look so).
EDIT: after trying them both (and banging my head against an hosting issue for which SwiftMailer did not output any type of hint) I completely changed my mind, I would definitely go with PHPMailer for at least one good reason: it's much easier to debug in the event you have any issue.
Both SwiftMailer and PHPMailer provide debug options (SwiftMailer with a plugin and PHPMailer by turning on
SMTPDebug = 2
), but SwiftMailer is made by hundreds of small files that make SwiftMailer more difficult to debug compared to the 3 files PHPMailer is made of.And about docs, the PHPmailer documentation is less fancy looking, but it has got all you need: simple tutorial, examples
由于 PHPMailer 和 PHP 5.3(甚至是最新版本)的问题,我今天刚刚切换到 Swift,这很遗憾。 Swift 有一个非常完善的集成文档,这让事情变得更容易。
I've just switched to Swift today due to the problems with PHPMailer and PHP 5.3 - even the latest version - which is a shame. Swift has a very well documented integration, which makes things easier.
我想说 PHPMailer 不再开发,而 Swift Mailer 正在开发。 但是当我用谷歌搜索时...
https://github.com/PHPMailer/PHPMailer
这表明它正在工作再次开启。
我经常使用 PHPMailer,它始终稳定可靠。 由于上述原因,我最近开始使用 Swift Mailer,它也没有给我带来任何麻烦。
现在PHPMailer又开发出来了,我想我可能会尝试一下新版本。
所以,我的答案是,两者都有能力,而且没有那么重要——选择一个,学习它,使用它。 两者都比 mail() 具有巨大的优势,并且抽象了电子邮件的细微差别,以便您可以继续开发您真正想要开发的内容。
I was going to say that PHPMailer is no longer developed, and Swift Mailer is. But when I googled ...
https://github.com/PHPMailer/PHPMailer
That suggests its being worked on again.
I've used PHPMailer a lot, and its always been solid and reliable. I had recently started using Swift Mailer, for the above reason, and it too has given me no trouble.
Now that PHPMailer is developed again, I think I'll probably give the new version a try.
So, my answer is that both are capable, and that it doesn't matter that much – choose one, learn it, use it. Both offer massive advantages over mail() and abstract away the nuances of email so that you can get on with whatever you are really trying to develop.
无论功能是什么,它们的适用许可证都有多种:
PHPMailer - LGPL 2.1 (https://github.com/PHPMailer /PHPMailer)
SwiftMailer - MIT 许可证 (https://github.com/swiftmailer/swiftmailer )
Whatever the features are, they have variety in their applicable licenses:
PHPMailer - LGPL 2.1 (https://github.com/PHPMailer/PHPMailer)
SwiftMailer - MIT license (https://github.com/swiftmailer/swiftmailer)
还有Zend_Mail。 如果我今天必须为一个新项目选择一个,我会认真考虑。
There is also Zend_Mail. If I had to pick one for a new project today, I would seriously consider that.
看过两者之后,我认为 SwiftMailer 的界面比 PHPMailer 好得多,并且正如有人指出的那样,Zend_Mail 也是另一个不错的选择,特别是如果您使用其他 Zend 组件。 如果您使用同一框架中的所有内容,那么生活会变得更加轻松。
Having looked at both I think SwiftMailer has a much nicer interface than PHPMailer and as someone has pointed out Zend_Mail is also another good option especially if you're using other Zend components. It makes life much easier if you use everything from the same framework.