So I'm trying to send an email using current version of PHPMailer (https://github.com/PHPMailer/PHPMailer). The SMTP connection and the mail sending is working fine, except the script is not using the "SetFrom" $email variable for the senders mail, but instead the "Username" email.
I've tried using multiple forms of setting the "From" mail and nothing seems to work, although it's important to note that the "name" in the "SetForm" is set just fine, but "email" is not.
Here's the code:
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = 'USERNAME(MY EMAIL)';
$mail->Password = 'PASSWORD';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->isHTML(true);
$mail->SetFrom($email,$name);
$mail->addAddress($email_received);
$mail->Subject = $subject;
$mail->Body = $user_msg;
$email
variable from the time it is created to when it is called in$mail->SetFrom($email,$name)
. Basically, is the value of$email
changing anywhere in the script? – Denis Priebe$email
follow the [email protected] format? – Denis Priebe