我正在尝试在php电子邮件中添加我的公司徽标,我会在订购后发送给客户。但是,它不起作用。我图像的实际链接是公共网址。
我做错了什么?
$logoImage = 'https://example.com/images/BFBlogo1.gif';
// Prepare the Email
$to = $email;
$subject = 'Your Example order'. $AuthorrizeResponseText; transaction Id or invoice #, however you set it up as.
$message = '<img src="'.$logoImage.'">';
$message = 'Thank you for ordering with us! ';
$from = "auto-confirm@example.com";
$cc = "order-receipts@example.com";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: ' .$to. "\r\n";
$headers .= 'From: ' .$from. "\r\n";
$headers .= 'Cc: '.$cc. "\r\n";
// Send the email
mail($to,$subject,$message,$headers);
我的第二次尝试:
$message = '<img src="'.$logoImage.'">';
$message .= 'Thank you for ordering with us! ';
答案 0 :(得分:2)
你忘记了联系:
$message = '<img src="'.$logoImage.'">';
$message = 'Thank you for ordering with us! '; // here $message is overwrtting.
应该是这样的:
$message = '<img src="'.$logoImage.'">';
$message .= 'Thank you for ordering with us! ';
<强>更新强>
logoImage = 'https://example.com/images/BFBlogo1.gif';
// Prepare the Email
$to = $email;
$subject = 'Your Example order'. $AuthorrizeResponseText;
$message = '<img src="'.$logoImage.'">';
$message .= 'Thank you for ordering with us! ';
$from = "auto-confirm@example.com";
$cc = "order-receipts@example.com";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Additional headers
$headers .= 'To: ' .$to. "\r\n";
$headers .= 'From: ' .$from. "\r\n";
$headers .= 'Cc: '.$cc. "\r\n";
// Send the email
mail($to,$subject,$message,$headers);
答案 1 :(得分:0)
您设置了图片代码:
$message = '<img src="'.$logoImage.'">';
然后在下一行你覆盖它:
$message = 'Thank you for ordering with us! ';
也许你打算连接?:
$message .= 'Thank you for ordering with us! ';
另请注意,如果邮件的整个主体几乎是一张图片,那么几乎任何查看邮件的邮件都会被视为垃圾邮件,我不会感到惊讶。它