雅虎smtp不发送邮件,但相同的代码在Gmail上工作正常.需要帮助.在本地服务器上工作



雅虎SMTP邮件程序的示例代码

此代码适用于Gmail,但对于雅虎来说,它的显示

SMTP -> ERROR: Failed           to connect to server: (0) 
SMTP Error: Could not connect to SMTP host. Message has been sent.......
with port no 465
SMTP -> ERROR: MAIL not accepted from server: 501 Syntax error in arguments 
The following From address failed: root@localhost Message has been sent.......

<?php
include('class.phpmailer.php');
include('class.smtp.php');
try {
$mail = new PHPMailer();  
$mail->IsHTML(true);
$mail->SMTPDebug  = 1;
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.mail.yahoo.com"; //smtp host
$mail->Port = 25; //port no.
$mail->Username = "eg@yahoo.com"; //account 
$mail->Password = "pass"; //password
$fromname = "name";
$email="someone@gmail.com";
$abcd="-------------";
$To = trim($email,"rn");
  $tContent   = '';
  $tContent .="<table width='550px' colspan='2' cellpadding='4'>
        <tr><td align='center'><img src='imgpath' width='100' height='100'></td></tr>
        <tr><td height='20'>&nbsp;</td></tr>
        <tr>
          <td>
            <table cellspacing='1' cellpadding='1' width='100%' height='100%'>
            <tr><td align='center'><h2>YOUR TEXT<h2></td></tr/>
            <tr><td>&nbsp;</td></tr>
            <tr><td align='center'>Name: ".trim($abcd,"rn")."</td></tr>
            <tr><td align='center'>ABCD TEXT: ".$abcd."</td></tr>
            <tr><td>&nbsp;</td></tr>                
            </table>
          </td>
        </tr>
        </table>";
  $mail->FromName = $fromname;        
  $mail->Subject = "Your Details."; 
  $mail->Body = $tContent;
  $mail->AddAddress($To); 
  //$mail->set('X-Priority', '1'); //Priority 1 = High, 3 = Normal, 5 = low
  $mail->Send();
    echo 'Message has been sent.......';
} catch (phpmailerException $e) {
echo $e->errorMessage();
}
?>

对于雅虎,您可能需要雅虎Plus帐户。 请参阅以下雅虎SMTP要求:

Yahoo! Mail Outgoing Mail (SMTP) Server: smtp.mail.yahoo.com
Use Authentication: Yes
Port: 25 or 587    
Yahoo! Mail Incoming Mail (POP3) Server: Only available in Yahoo! Mail Plus
Account Name: Your full email address or your Yahoo! ID
Email Address: Your email address
Password: Your Yahoo! ID password

注 1:如果您的互联网服务提供商 (ISP) 阻止端口 25,则必须使用备用 SMTP 端口号,例如 587。

注2:AT&T客户使用带有SSL的 smtp.att.yahoo.com 和端口465

注3:如果您使用的是Yahoo!小型企业电子邮件,请在此处查看更多详细信息。

您可以使用Outlook/Hotmail,AOL外发邮件的其他提供商

最新更新