沃梦达 / 编程问答 / php问题 / 正文

PHP中是否有SMTP邮件传输库

Is there a SMTP mail transfer library in PHP(PHP中是否有SMTP邮件传输库)

本文介绍了PHP中是否有SMTP邮件传输库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个电子邮件传输服务,并且需要一个 MTU 替换 sendmail/postfix.

I want to write an email transfer service and need a MTU replacement of sendmail/postfix.

我不是在寻找如何传送到传输 SMTP 服务器(如 SMTP 端口上的后缀列表).我也不需要服务器的接收部分,退回等将转到不同的现有后缀.

I'm not looking how to deliver to a transmitting SMTP server (like a postfix listing on a SMTP port). I also don't need the receiving part of the server, bounces etc. would go to a different existing postfix.

所有这些都在纯 PHP 中.SMTP 是一个非常简单的协议,但这需要访问 MX DNS 记录和其他需要注意的许多细节.

All of it in pure PHP. SMTP is a pretty easy protocol but this would require access to the MX DNS record and other lot of details that need to be taken care of.

我为什么需要这个?因为大多数共享互联网提供商对于每天发送 500 封电子邮件的限制非常低.如果您想设置流量最低的电子邮件列表,那几乎没有什么.

Why do i need this? Because most shared internet providers have insane low limits for sending out emails like 500 per day. Thats almost nothing if you want to setup even the lowest traffic email list.

请注意:代码需要连接到接收方 SMTP 服务器并使用经过调整的标头集(删除 BCC 列表,添加 Path 路由)传递消息.如果您看到 SMTP 类少于 5000 行或需要您配置 SMTP hostip 和端口,那么这不是我要找的东西.

Please Note: The code needs to connect to the receivers SMTP server and deliver the message with an adapted header set (removed BCC list, added Path route). If you see a SMTP class less then 5000 lines or requires you to configure a SMTP hostip and port then this is not the stuff i'm looking for.

它需要像 PHP 库一样完成 sendmail 所做的所有事情.

It needs to do all the stuff sendmail is doing just as a PHP library.

推荐答案

我用 Pear 的邮件 类.

编辑

重新阅读后,我发现它不仅仅是一个库.您要求直接发送到远程 MX.

After re-reading this, I see there's more to it than just a library. You are asking to send direct to the remote MX.

为什么要重新发明轮子?在服务器上设置一个 postfix 实例,它只监听来自 Web 服务器的连接......并让 MTA 做它最擅长的事情.将消息从 php 传递到真正的邮件服务器,然后继续.

Why reinvent the wheel? Set up an instance of postfix on the server, which only listens to connections from the web server... and let an MTA do what it does best. Hand off the messages from php to a real mail server and move on.

在 ISP 阻止出站端口 25 并强制使用智能主机的情况下,这也允许您限制发送到智能主机的消息速率.

In the case of ISP's that block outbound port 25 and force the use of a smarthost, this also allows you to restrict the rate of messages sent to the smarthost.

最后,从您的 php 脚本直接发送 MX 是一个坏主意,因为如果您发送给我,我将永远不会收到它.我和许多其他网站使用灰名单"来减少垃圾邮件,这会拒绝所有初始请求并出现 450 临时错误.真正的 MTA 会重试,但除非您实施延迟队列并重试,否则您的消息将永远无法通过.

Lastly, sending straight to the end MX from your php script is a bad idea, because if you send to me, I'll never get it. I and many other sites use "greylisting" to reduce spam, which denies all initial requests with a 450 temporary error. Real MTA's will try again, but unless you implemented a delay queue and try again, your message will never go through.

这篇关于PHP中是否有SMTP邮件传输库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:PHP中是否有SMTP邮件传输库

基础教程推荐