我应该使用php邮件功能还是phpmailer? [英] Should I use php mail function or phpmailer?

查看:137
本文介绍了我应该使用php邮件功能还是phpmailer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,到目前为止,我一直在使用php内置的函数,mail(),我没有任何问题,即使我发送一个爆炸到1000多个用户。但是最近我发现这个phpmailer是专门设计来发送邮件的。



Q1:我应该改为这个phpmailer吗?



Q2:使用phpmailer有什么好处?



Q3:我在phpmailer网站上发现了其他产品,即phpmailer FE,ML等等。你们正在使用哪一个?



Q4:有人试图通过phpmailer向2000多名用户发送邮件吗?如果是,是否会导致任何问题?

解决方案

Q1:您应该切换远离使用邮件()



Q2: mail()功能真的是真的简单的东西。邮件库从用户那里隐藏了很多低级别的东西,并提供了简单的方式来制作HTML电子邮件,嵌入图像的邮件等。



而不是phpmailer我会推荐 SwiftMailer




  • 发送电子邮件使用SMTP,sendmail,postfix或您自己的自定义传输实现

  • 支持需要用户名和密码的服务器。密码和/或加密

  • 免除头端注入攻击而不剥离请求数据内容

  • 发送MIME兼容的HTML /多部分电子邮件

  • 使用事件驱动的插件来自定义库

  • 处理大量附件和内存/内嵌图像的内存不足



我使用SwiftMailer发送15000多封邮件,但是您可以在SwiftMailer文档中找到,建议以较小的批次发送邮件(取决于您的服务器,例如100,200, 500元/批),使用cron。


Well, so far, I have been using php built in function, mail(), and I have no problems with it, even I sent a blast to 1000+ users. But then, lately I found this phpmailer, which is specially design to send email.

Q1: Should I change to this phpmailer?

Q2: What are the advantages of using phpmailer?

Q3: I found other products on phpmailer website, i.e phpmailer FE, ML etc. What are those? Which one you guys is using?

Q4: Have anyone tried sending blast email to 2000+ users with phpmailer? If yes, does it cause any problems?

解决方案

Q1: You should definitely switch away from using mail()

Q2: mail() function is really, really for simple stuff. Mail libraries hide a lot of low level stuff from the user, and offer simple ways to make HTML emails, embedded images in mail, etc.

Instead of phpmailer I'd recommend SwiftMailer

  • Send emails using SMTP, sendmail, postfix or a custom Transport implementation of your own
  • Support servers that require username & password and/or encryption
  • Protect from header injection attacks without stripping request data content
  • Send MIME compliant HTML/multipart emails
  • Use event-driven plugins to customize the library
  • Handle large attachments and inline/embedded images with low memory use

I've used SwiftMailer to send 15000+ mails, but as you'll find in SwiftMailer documentation, its recommended to send mails in smaller batches (depends on you server ex. 100, 200, 500 per batch), using cron.

这篇关于我应该使用php邮件功能还是phpmailer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆