0
votes

would anyone know if it is possible to run phpmailer with STARTTLS encryption?

The story: an online order form that sends the output to both the site visitor and site owner. The goal is that the visitor receives an email from [email protected], while the site owner receives an email from [email protected] (the address that the visitor has filled i the online form).

I have the phpmailer running fine with my Gmail account, using TLS on port 587. I would, however, like to use mailbox provided along with the hosting (so that the from/replyTo looks professional, no freemail). Unfortunately, the hosting provider does not provide TLS - in their knowledgebase they only mention STARTTLS. I tried all combinations of SSL, TLS and STARTTLS for encryption and 465 and 587 for ports with no success.

Would anyone know if STARTTLS is somehow achievable, please?


My plan B would was to use the Gmail SMTP credentials and then tinker with addReplyTo, setFrom and addAddress in the phpmailer SMTP settings. I tried but if I use...

$mail->addReplyTo($_POST['customeremail'], $_POST['customername']);

...the from email address the site owner receives is that of my Google email - I understand this may be some Google email spoofing protection, which just doesn`t allow the SMTP to send an email with the From address taken from the form. - please see the attached ![Thunderbird screen( image: imgur.com/a/1f6vY).

Can this be possibly overridden?

I mean, with that plan B solution, I can grant Google access to send emails on behalf of [email protected], that`s all fine, it will then mimick the professional domain address. But I cannot do the same for the visitor address (taken from the form), that makes sense, right?

Thanks a bunch in advance...

1
Sorry, hereby the image: imgur.com/a/1f6vYLis Zcgsedt
I mean, with that plan B solution, I can grant Google acccess to send emails on behalf of [email protected], that`s all fine, it will then mimick the professional domain address. But I cannot do the same for the visitor address (taken from the form), that makes sense, right?Lis Zcgsedt

1 Answers

0
votes

Yes, PHPMailer does TLS encryption by default. Look at the SMTPSecure property for more details.

Gmail does indeed prevent you from setting arbitrary from addresses, though you can pre-set aliases in your account. This is mentioned in the PHPMailer docs and has been covered many times on here.