雅虎邮件上没有显示什么标志

What logo not showing on yahoo mail

我的 phpmailer 工作正常,但徽标不会显示在 yahoomail 上,但会显示在 webmail 上。可能有什么问题?

我已经尽力了。

谢谢。

require 'PHPMailerAutoload.php';

$mail = new PHPMailer;

//$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                                      // Set mailer to use SMTP
$mail->Host = 'mail.example.com';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'username';                 // SMTP username
$mail->Password = 'password';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to

$mail->From = 'email@example.com';
$mail->FromName = 'John Doe';
$mail->addAddress('email@eaxample.com', 'John Doe');     // Add a recipient
$mail->addAddress('email@eaxample.com.com');               // Name is optional
$mail->addReplyTo('email@eaxample.com.com', 'John Doe');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');

//$mail->addAttachment('/var/tmp/file.tar.gz');         // Add attachments
$mail->addAttachment('logo.png', 'logoimage');
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg');    // Optional name
$mail->isHTML(true);                                  // Set email format to HTML

$mail->Subject = 'THINKING ALOUD';
$mail->Body    = '
<img src="cid:logoimage">
<h2>Welcome</h2>
Hello. It me <b>Everyone!</b>';
$mail->AltBody = 'Hello, its me Everyone';

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

谢谢。 我已经找出问题发生的原因。问题是 $mail->addAttachment('logo.png', 'logoimage')。我改为 $mail->embedImage('logo.png', 'logoimage', 'logo.png') 瞧!成功了。

因此 addAttachment 仅被识别为附件,但 webmail 仍会读取它,但 yahoo 不会

您正在寻找另一种方法。相反:

$mail->addAttachment('logo.png', 'logoimage');

使用以下代码将图片嵌入到邮件中:

$mail->AddEmbeddedImage('logo.png', 'logoimage');

参考:PHPMailer method list