Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#94 Gmail from field

open
nobody
None
5
2012-09-18
2009-06-17
No

Hello, when i use authentication using Gmail, i can send the message ok, but the From field in message header is the account that i have used to send the email and not the account i use in From.

The code is the next:

$mail->IsSMTP();
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 465; // set the SMTP port

$mail->Username = "envios@vant.es"; // GMAIL username
$mail->Password = "**"; // GMAIL password

$mail->From = "fromemail@gmail.com";
$mail->FromName = "David";
$mail->Subject = "This is the subject";
$mail->AltBody = "This is the body when user views in plain text format"; //Text Body
$mail->WordWrap = 50; // set word wrap
$mail->Sender = "seiferdrg@hotmail.com";

$mail->MsgHTML($body);

$mail->SetFrom('fromemail@gmail.com', 'David');
$mail->AddReplyTo("fromemail@gmail.com","David");
$mail->AddAddress("david.rojo.gonzalez@gmail.com","David Rojo");

$mail->IsHTML(true); // send as HTML

$mail->Send();

And what i recieve at gmail is the image attached.

envios@vant.es is the account i use to authenticate with gmail, but i don't want to appear in the header of the message recieved.

That issue makes that gmail groups all the emails sent by phpmailer as a same conversation, ignoring the from value.

Thanks

Discussion

  • The result

     
    Attachments