【发布时间】:2015-11-18 16:36:55
【问题描述】:
我正在使用 PHPMailer 在我的 PHP 程序中发送邮件。电子邮件工作正常,但它显示来自区域的地址邮寄。我如何在 PHPMailer 中隐藏这些邮寄的内容。也可以通过来自区域的电子邮件的详细信息。
当我使用下面的 php mail() 函数时,它会删除由详细信息发送的邮件。但是我如何在 PHPMailer 中做到这一点
mail('info@example.com', 'Subj', "Message", $headers, '-freturn@yourdomain.com')
这是 php 邮件程序代码
<?php
require_once 'phpmailer/class.phpmailer.php';
$mail = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch
$body = "Heloooo";
try {
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
$mail->AddAddress('to@example.com', 'John Doe');
$mail->SetFrom('info@example.ae', 'Info');
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
$mail->Subject = 'PHPMailer Test Subject via mail(), advanced';
$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML($body);
$mail->Send();
echo "Message Sent OK<p></p>\n";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
?>
【问题讨论】:
-
我认为你应该使用 SMTP。