I’m trying to send a mail with PHPmailer and gmail. But when I send a mail its from my gmail account instead of no-reply. How do I set no-reply as from?
Code I have:
$mail = new PHPMailer();
$mail->Mailer = "smtp";
$mail->Host = "ssl://smtp.gmail.com";
$mail->Port = 465;
$mail->SMTPAuth = true;
$mail->Username = "myAccount@web.com";
$mail->Password = "password";
$mail->From = "no-reply@web.com";
$mail->AddAddress($to);
$mail->AddReplyTo("no-reply@web.com","no-reply");
$mail->Subject = $subject;
$mail->Body = $msg;
$mail->WordWrap = 150;
$mail->send();
The mail I get receives (headers):
Return-Path: <myAccount@web.com>
Which should be no-reply@web.com
Thanks in advance
You can’t do it. Just imagine sending mail prompting to reply with your bank account credentials from an address
validation@yourbank.com.To have no-reply address you must have an access to the mail server in
@your.domain(not gmail) and create such account there, then send emails using this account.