发送电子邮件PHP错误 [英] Error sending email PHP

查看:135
本文介绍了发送电子邮件PHP错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网上找到了一些php代码,并对它进行了一些修改,以便它对我有用。这样做的目标是通过我的域名中的电子邮件向我的收件人发送一封电子邮件,其中包含我想要的信息。它为我的一些电子邮件工作,但是当我将电子邮件发送到我拥有的电子邮件列表中时,我收到了一个错误,内容如下:

标题 - 未发送的邮件返回发件人

消息 -
这是主机gateway06.websitewelcome.com上的邮件系统

我很抱歉要通知您,您的消息不能
交付给一个或多个收件人,如下所示:

如需进一步帮助,请发送邮件至postmaster

如果你这样做,请包括这个问题报告,你可以从
中删除你自己的文本

邮件系统

5.1.1< wyunnluqxas12@aol.com> ;:收件人地址被拒绝:aol.com(在
中回复RCPT TO命令)

我正在使用它将电子邮件发送给reci pient如下所示:

 <?php 
include(Mail.php);

$ recipients = $ _GET ['email'];

$ headers [From] =;
$ headers [To] = $ recipients;
$ headers [Subject] =;

$ body ='';

$ params [host] =;
$ params [port] =25;
$ params [auth] = true;
$ params [username] =;
$ params [password] =;

//使用Mail :: factory方法创建邮件对象
$ mail_object =& Mail :: factory(smtp,$ params);

$ mail_object-> send($ recipients,$ headers,$ body);

?>

我做错了什么?为什么它对一些收件人有效(我使用@ gmail.com电子邮件与两个人一起尝试过),而不是为其他人工作? 解决方案

<脚本很好&清楚地发送了消息。邮件只是反弹,这不是脚本的一个因素,但邮件传输过程失败。也就是说,这看起来像是:


  1. 一个电子邮件地址不正确或不存在。

  2. 您的服务器中的邮件被 AOL.com 拒绝,因为它不符合真实(又名:非垃圾邮件)电子邮件的标准。需要设置PTR记录或者需要调整SPF记录。

将根据我自己的个人情况扩展到第2点经验: AOL.com 是众所周知的收件人,如果他们违反了某些标准,他们会弹出邮件。我遇到的最常见的是在发送机器的一部分上缺少PTR(又名:反向DNS记录)。或者您的域的SPF(发件人策略框架)记录不验证您的IP地址。

/ kb /?id = 1317rel =nofollow> PTR & SPF 是自己的主题,但我有一种直觉,认为其中一方或双方都必须固定在您身边 - 作为发件人 - 让电子邮件正确发送至 AOL.com


I found some php code online and made some alterations to it so that it would work for me. The goal of this is to send an email to the recipient with the message I want, from my email at my domain. It has worked for me for some emails, but when I send the email to the list of emails I have, I get an error back in my inbox with the following text

Title - "Undelivered Mail Returned to Sender"

Message - "
This is the mail system at host gateway06.websitewelcome.com.

I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.

For further assistance, please send mail to postmaster.

If you do so, please include this problem report. You can
delete your own text from the attached returned message.

                   The mail system

<wyunnluqxas12@aol.com>: host mailin-04.mx.aol.com[64.12.88.131] said: 550
    5.1.1 <wyunnluqxas12@aol.com>: Recipient address rejected: aol.com (in
    reply to RCPT TO command)"

The code that I am using to send the email to the recipient is as shown below:

<?php
include("Mail.php"); 

$recipients = $_GET['email'];

$headers["From"]    = ""; 
$headers["To"]      = $recipients; 
$headers["Subject"] = ""; 

$body = ''; 

$params["host"] = ""; 
$params["port"] = "25"; 
$params["auth"] = true; 
$params["username"] = ""; 
$params["password"] = ""; 

// Create the mail object using the Mail::factory method 
$mail_object =& Mail::factory("smtp", $params); 

$mail_object->send($recipients, $headers, $body); 

?>

What am I doing wrong? Why is it working for some recipients (I tried with two people using @gmail.com emails), and not working for others?

解决方案

The script is fine & clearly sent the message. The mail was simply bounced which is not a factor of the script but of the mail transport process failing. That said, this seems like either:

  1. An e-mail address that is simply incorrect or dead.
  2. Mails from your server are being rejected by AOL.com because it doesn’t meet their criteria for real (aka: non-spam) e-mail. Either a PTR record needs to be set or SPF records need to be adjusted.

Will expand on point number 2 based on my own personal experiences: AOL.com is pretty well known as a recipient who will bounce messages if they fail certain standards. The most common one I run into is the lack of a PTR (aka: reverse DNS record) on a part of the sending machine. Or perhaps the SPF (Sender Policy Framework) record for your domain not validating your IP address.

PTR & SPF are topics onto themselves, but I have a gut feeling that one or both of those have to be fixed on your side—as the sender—to get e-mails to send properly to AOL.com.

这篇关于发送电子邮件PHP错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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