Google App-Gmail Unable to Install. Gmail, which replaces the address when sending via the Swiftmailer SMTP transport (PHP)

Hi, thank you for any help in advance.

I am using the swiftmailer, SMTP method to send email from my PHP script.

Sending a message is OK. He works.

The problem is that no matter how I set the FROM, REPLYTO, SENDER parameters, the email arrives as a GMAIL mailbox (ME - me@mydomain.com ).

$transport = Swift_SmtpTransport::newInstance('imap.gmail.com', 465,'ssl') ->setUsername($login) ->setPassword($password) ; $message = Swift_Message::newInstance($subject) ->setFrom(array(' test@testdomain.com ' => 'test mcttest')) ->setReplyTo(array(' test@testdomain.com ' => 'test mcttest')) ->setSender(' test@testdomain.com ') ->setTo(array($to)) ->setBody(wordwrap($body, 70)) ->setContentType('text/plain') ; 

So, email goes through a fine, but instead of being from TEST-test@testdomain.com as the sender ... it's ME-me@mydomain.com

I switch to a separate (non-gmail) SMTP server for testing, and the email went fine, without any problems ... definitely think it is GMAIL.

Does anyone know how to get around this?

+4
source share
2 answers

Yes, it’s Gmail that changes the sender’s email address in the same way as the account you are checking. There is no workaround for this, except possibly becoming a paid Google Apps client.

+2
source

Oddly enough, I ran into the same problem. But, to understand a little, I think this is a Swiftmailer problem.

There are other libraries and frameworks (Codeignitor appears in my head) that will allow you to use Googlemails SMTP servers to mask the address from the address as the email address of your choice.

0
source

Source: https://habr.com/ru/post/1339146/


All Articles