PHP邮件使用FROM多个邮件客户端(Yahoo | Google | Hotmail | Rediff |个人邮箱) [英] PHP mail use FROM of multiple mail client (Yahoo | Google | Hotmail | Rediff | Personal Mail domain)

查看:201
本文介绍了PHP邮件使用FROM多个邮件客户端(Yahoo | Google | Hotmail | Rediff |个人邮箱)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在使用PHP邮件功能或CodeIgnitor邮件功能发送邮件。
从邮件ID可以是任何域,例如xyz@gmail.com,xyz@yahoo.com,xyz@hotmail.com



还要邮件可以任何域名。



当FROM设置为除YAHOO之外的任何邮件时,我的邮件已正确发送。
从YAHOO的任何邮件发送邮件从PHP邮件的麻烦。
雅虎是否阻止我的邮件?



我如何解决这个问题?

解决方案

你不能发送使用您的邮件服务器代表上述域名成功发送邮件。这些域中的每一个都使用称为DNS中的SPF(发件人策略框架)记录,该记录告诉所有收件人,检查SPF的邮件服务器确认发件人IP与SPF相同。您需要通过自己的SMTP服务器发送电子邮件。



GMAIL& YAHOO

  v = spf1 redirect = _spf.google.com 
v = spf1 redirect = _spf.mail .yahoo.com

使用此站点检查域上是否存在SPF记录: / strong>



http://mxtoolbox.com/ spf.aspx



在我看来,您最好的选择是将邮件中继到每个域的正确SMTP服务器。您可以使用 PHPMailer 轻松实现。如果FROM选项中设置的域是私有管理域,那么如果没有设置SPF记录,并且您的发送IP未被列入黑名单,那么您应该可以代为继承。



检查您的发送IP是否被列入黑名单的网站:



http://mxtoolbox.com/blacklists.aspx



您可以选择哪种SMTP设置的示例用于特定域:

  $ email ='xyz@yahoo.com'; 
$ domain = explode('@',$ email);

开关($ domain [1]){

case'yahoo.com':

//不真实的SMTP设置!
$ mail-> Host ='smtp1.yahoo.com';
$ mail-> SMTPAuth = true;
$ mail-> Username ='user@yahoo.com';
$ mail-> Password ='secret';
$ mail-> SMTPSecure ='tls';
$ mail-> Port = 587;

break;

case'gmail.com':

//不真实的SMTP设置!
$ mail-> Host ='smtp1.gmail.com';
$ mail-> SMTPAuth = true;
$ mail-> Username ='user@yahoo.com';
$ mail-> Password ='secret';
$ mail-> SMTPSecure ='tls';
$ mail-> Port = 587;

break;


}


// PHP邮件代码


Currently I'm Using PHP mail function Or CodeIgnitor mail function to send mail. From mail id can be of any domain , example xyz@gmail.com, xyz@yahoo.com, xyz@hotmail.com

Also To mail can be of any domain.

My mails are sent proper when FROM is set to any mail other than that of YAHOO. Having trouble to send mail from PHP mail FROM any mail of YAHOO. Is yahoo blocking my mails ?

How can I solve this problem ?

解决方案

You cannot send mail successfully on behalf of the domains stated above using your mail server. Each of those domains have something in use called an SPF (Sender Policy Framework) record in DNS which tells all recipients mail severs which check SPF to confirm the senders IP is the same as the SPF. You would need to send the email via their SMTP servers by relaying from your own.

SPF example for GMAIL & YAHOO

v=spf1 redirect=_spf.google.com
v=spf1 redirect=_spf.mail.yahoo.com

Check if an SPF record exists on domain by using this site:

http://mxtoolbox.com/spf.aspx

In my opinion, your best option is to relay your mail to the correct SMTP servers per domain. You can do this very easily using PHPMailer. If the domain set in the FROM option is a privately managed domain, then you should be able to relay on there behalf if no SPF record is set and your sending IP is not blacklisted.

A site for checking if your sending IP is blacklisted:

http://mxtoolbox.com/blacklists.aspx

An example of how you can choose which SMTP settings are used for a specific domain:

$email = 'xyz@yahoo.com';
$domain = explode('@', $email) ;

switch ($domain[1]) {

    case 'yahoo.com': 

          //NOT REAL SMTP SETTINGS!
          $mail->Host = 'smtp1.yahoo.com'; 
          $mail->SMTPAuth = true;                               
          $mail->Username = 'user@yahoo.com';                 
          $mail->Password = 'secret';                           
          $mail->SMTPSecure = 'tls';                           
          $mail->Port = 587;          

    break;

    case 'gmail.com': 

          //NOT REAL SMTP SETTINGS!
          $mail->Host = 'smtp1.gmail.com';
          $mail->SMTPAuth = true;                               
          $mail->Username = 'user@yahoo.com';                 
          $mail->Password = 'secret';                           
          $mail->SMTPSecure = 'tls';                           
          $mail->Port = 587;          

    break;


}


//Rest of PHP Mailer code

这篇关于PHP邮件使用FROM多个邮件客户端(Yahoo | Google | Hotmail | Rediff |个人邮箱)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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