加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

php – 是否可以在没有SMTP设置的情况下发送邮件?

发布时间:2020-12-13 15:57:27 所属栏目:PHP教程 来源:网络整理
导读:如果没有主机,用户名和密码等SMTP设置,我必须发送邮件.有可能在 PHP或任何其他语言? 解决方法 是的,可以使用 mail()功能执行此操作.但请考虑以下限制: Note: The Windows implementation of mail() differs in many ways from the Unix implementation. Fi
如果没有主机,用户名和密码等SMTP设置,我必须发送邮件.有可能在 PHP或任何其他语言?

解决方法

是的,可以使用 mail()功能执行此操作.但请考虑以下限制:

Note: The Windows implementation of mail() differs in many ways from
the Unix implementation. First,it doesn’t use a local binary for
composing messages but only operates on direct sockets which means a
MTA is needed listening on a network socket (which can either on the
localhost or a remote machine). Second,the custom headers like From:,
Cc:,Bcc: and Date: are not interpreted by the MTA in the first place,
but are parsed by PHP. As such,the to parameter should not be an
address in the form of “Something “. The mail
command may not parse this properly while talking with the MTA.

Note: It is worth noting that the mail() function is not suitable for larger volumes of email in a loop. This function opens and closes an SMTP socket for each email,which is not very efficient.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读