I have a customer support form that submits to PHP which uses the latest version of PHPMailer to send an email from my new hosted SMTP server to a support ticket system.
Using the old SMTP server I was able to set the $mail->From
field to the customers email address which would allow the tech support people to simply reply direct to the customer, however the new SMTP server forces me to specify that the email is from the account I auth with.
Normally this would be resolved using $mail->AddReplyTo("<<customeremail>>", "<<customername>>")
or $mail->ReturnPath="<<customeremail>>"
but both are being ignored by the support ticket system (and my email inbox if I send the emails there for testing).
I can get around this in outlook by changing the From address, when I look at the email header this seems to specify From: <<customeraddress>>
and Sender: <<smtpauthaddress>>
, I can also mimic this by logging in to the SMTP server via command line, specifying MAIL FROM: <<smtpauthaddress>>
and putting From: <<customeraddress>>
in the header. If I try to take this over to PHPMailer using the following:
$mail->From = "<<smtpauthaddress>>";
$mail->addCustomHeader("From: <<customeraddress>>");
But checking the header it's adding both From: <<smtpauthaddress>>, <<customeraddress>>
, so what I need help on is either stopping it from adding smtpauthaddress to the header or strip the header out and add a clean one before sending the email.
Sorry for the wall of text, this site said to be specific!