Question

Hello I am trying to send email messages with swiftmailer version 4.0.3. I get a returncode 2. And it seems the messages are sent, however they don't arrive.

I am using the sendmail transport mode

$this->psTransport = Swift_SendmailTransport::newInstance('/usr/sbin/sendmail -t');

I get a return code of 2 and no exception happens.

Anyone familiar with this problem?

Was it helpful?

Solution

The SMTP Transport, Swift_SmtpTransport is without doubt the most commonly used Transport because it will work on 99% of web servers.

It is a more profissional way to do what you want. See the docs:

http://swiftmailer.org/docs/smtp-transport

SMTP Transport is simple and your messages are better recognized by the receivers because it's not your webserver sending your emails, but an email server already stabilished, with a known and approved ip.

OTHER TIPS

Using PHP sockets to send mail is most of the times penalized by remote SMTP servers and detected as spam. I've suffered the same issue several times.

My advise is to use a SMTP transport method instead and send your messages through a recognized and validated SMTP sender server. If you are not sending too much messages per hour you can even use GMail servers, I use them very often for tests and small applications.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top