I am facing this problem where the mail is getting sent as a different email rather than the one specified.
$from_name = 'send';
$from = 'send@test.com';
$to = 'receive@test.com';
$to_name = 'receive';
$also_to = 'cc@test.com';
$also_to_name = 'cc';
$message = 'Dear receive Thank you for the booking';
$message .= '<br><br>'.$homepage;
$mail = new PHPMailer();
$mail->SMTPDebug = 0;
$mail->IsSMTP();
$mail->Port = 465;
$mail->Host = "ssl://smtp.gmail.com";
$mail->SMTPAuth = true;
$mail->Username = 'send1@test.com';
$mail->Password = ******;
$mail->SetFrom($from,$from_name );
$mail->AddReplyTo($from,$from_name );
$mail->Subject = 'Booking Details';
$mail->MsgHTML($message);
$mail->AddAddress($to,$to_name);
$mail->AddCC($also_to,$also_to_name);
When I sent it using this code the mail goes with name as 'send' but not the 'send@test.com' email address it gets sent from "send -> send1@test.com" rather than send -> send@test.com. Above I have mentioned the smtp details that i have used. Also when i change:
$mail->Username = 'send@test.com';
$mail->Password = ******;
The mail does not go through to any email address. I hope this is clear enough for you guys and I would appreciate any help. Thank you