CodeIgniter Forums
How can I test outgoing e-mail? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: Best Practices (https://forum.codeigniter.com/forumdisplay.php?fid=12)
+--- Thread: How can I test outgoing e-mail? (/showthread.php?tid=65050)

Pages: 1 2


RE: How can I test outgoing e-mail? - Wouter60 - 05-03-2016

The Test Mail Server Tool that you mentioned before, works great for testing. If I would set my provider's smtp settings in php.ini, then the mails would actually be sent to the recipients, wouldn't they? With the Test Tool, that's not the case, and I can check the lay-out and contents of the mails without bothering anyone.
Only (small) problem is that some characters are being replaced by equal-signs.


RE: How can I test outgoing e-mail? - alotufo - 05-03-2016

I use this online tool to test outgoing email from my CI applications. Works very well.

https://www.mail-tester.com

Just go to the site and it will generate an email address for you to send to. Then configure your CI application to send to that address and after it's sent, click the button on the website that says 'Then Check Your Score'. It should reveal all of the information you need to have your application reliably send emails. Follow the steps it suggests, correct the problems and repeat until you have a good score.

For the problem with equal signs in emails, from my experience this is a problem when sending to some Microsoft mail servers. I don't have this problem with my GMail account. To fix it, try adding this before sending the email:

Code:
$this->email->set_crlf("\r\n");

Note: This fix above only worked for me for some reason when I used it in the controller. If I added it to an email config file, it didn't work.


RE: How can I test outgoing e-mail? - InsiteFX - 05-03-2016

This is usually caused by an email setting:

Email Setting


RE: How can I test outgoing e-mail? - skunkbad - 05-03-2016

I've built my own custom mail queue, which allows email to be sent to be stored in the database. Cron sends out unsent email once each minute. This allowed me to built a custom interface to view the contents of each email, even after it has been sent. Email attachments are also stored in the database record for each email, in case you wanted to know. I also made all of this a driver so I can switch between swiftmailer and CI's email class. I can't share this code with you, due to a licensing agreement, or I would. It's not that hard to do.