I have problem with the PHP MAILER function. I am using GMAIL SMTP Authentication for sending email and also its working perfectly but i want to set "From" email like "[email protected]" but it doesn't working properly.
I used below code to set "From" email
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "mail.gmail.com"; // SMTP server
$mail->SMTPDebug = 0; // enables SMTP debug information (for testing)
$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 for the GMAIL server
$mail->Username = "[email protected]"; // GMAIL username
$mail->Password = "test@123";
$mail->SetFrom("[email protected]","Domian");
It's showing me default email [email protected] instead of [email protected]
Please help me out.
Thanks in Advance!