I am using PHPMailer to send mail in my Php program. Email is working fine but it showing mailed by address in from area.How can i hide these mailed by in PHPMailer.and also via details from Email from area.
When i use php mail() function like below its removing mailed by details.But how can i do it in PHPMailer
mail('info@example.com', 'Subj', "Message", $headers, '-freturn@yourdomain.com')
Here is php mailer code
<?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>
";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
?>
You can just remove the below two lines.
$mail->SetFrom('info@example.ae', 'Info');
$mail->AddReplyTo('name@yourdomain.com', 'First Last');
Then the mail details will show from as "Root User root@localhost"
. But it will show from which server you are sending it.
Even you use the SMTP with phpmailer, you can do the same.