php 与 smtp 服务器交互并发送电子邮件所需的确切代码是什么?
可能的重复:
使用 PHP 发送群发电子邮件
有人知道吗?我正在尝试设置一个 php 文件,以将以表单提交的数据发送到 mysql 数据库以及三个电子邮件地址之一(通过 if 语句)。但是,我被告知,我需要设置和管理 smtp 服务器,并在与 smtp 服务器连接的 php 文件中编写代码,以便我可以发送电子邮件。但是,我不知道如何做这些事情,如果有人知道,你介意帮助我吗?如果是这样,我将不胜感激。
Possible Duplicate:
Sending mass email using PHP
Does anyone out there know? I am trying to set up a php file to send data submitted in a form to a mysql database and also one of three email addresses (by means of an if statement). However, I am being told, I need to set up and manage an smtp server and also write code in my php file that connects with smtp server so that it will be possible for me to send email. However, I don't know how to do any of these things and if there is someone out there who does, would you mind helping me out? If so, I would greatly appreciate it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我不知道是否有人会给你确切的代码,但我强烈推荐 SwiftMailer 库。
通读一下文档并尝试一下。它支持通过 SMTP 服务器发送,而不是使用 PHP
mail()
功能。I don't know if anybody is going to give you exact code, but I highly recommend the SwiftMailer library.
Read through the documentation a bit and try it out. It supports sending through your SMTP server instead of using the PHP
mail()
function.如果您熟悉 Zend 框架,还有一个非常高级的邮件功能: Zend_Mail< /a>
If you are familiar with Zend framework, there is also a pretty advanced mail feature : Zend_Mail
阅读 PHP 手册的 mail() 页面 将是一个好的开始
Reading the PHP manual's page for mail() would be a good start
PHP 实际上并不发送邮件。您需要在侦听连接的主机上设置邮件服务器。然后在您的代码中,您只需使用
mail
命令即可实际发送电子邮件。PHP doesn't actually send the mail. You need a mail server setup on a host machine that is listening for connections. Then in your code you can just use the
mail
command to actually send the email.