• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How can I debug disappearing emails?

#1
[eluser]rideearthtom[/eluser]
I have built an app which sends a fair few emails using the CI email class. $this->email->send() returns true, but the email is never received by the recipient. I've tried mail, sendmail, text, html, all config options I can think of.

I have full access to the server, so is there a way of seeing any logs of the underlying PHP activity or mail/sendmail activity?

#2
[eluser]danmontgomery[/eluser]
Have you tried this?

#3
[eluser]stratton[/eluser]
I've found the 'print_debugger' method really helpful when troubleshooting email...
Code:
$this->email->print_debugger();
It returns a string containing any server messages, the headers, and the message.

#4
[eluser]rideearthtom[/eluser]
[quote author="noctrum" date="1268855567"]Have you tried this?[/quote]

This isn't going to help - it makes no difference whether I set sendmail, mail, smtp etc - send() returns true, but nothing is sent.

Heck, even the email helper's send_email() function doesn't send an email.

Here's another mystery:

Code:
$this->email->print_debugger();

If I call this on the next line after setting up $this->email parameters, I get the following:

Code:
<pre></pre>

Obviously I've loaded the email library and config in autoload.php.

I've spent days trying to figure out the problem, and it's driving me nuts!

#5
[eluser]rideearthtom[/eluser]
I've discovered the following:

* Autoloading the email config DOES populate the $config array being populated with the elements.
* Autoloading the email config DOES NOT populate the $this->email with the relevant $config elements.
* Removing email config from autoload and loading it from the controller with $this->load->config('email') DOES populate $this->email with the relevant $config elements, AND populates the $config array with the same elements as it does when autoloading.
* It makes no difference whether the email library is autoloaded or loaded in the controller.

So the mystery is why the email library, regardless of whether it's autoloaded or loaded from the controller, fails to pick up on the autoloaded $config elements, but does pick up on the exact same elements when they're loaded by the controller?

It also seems strange that I'm alone in this problem!

#6
[eluser]rideearthtom[/eluser]
I should add that the email still doesn't get sent, whether or not the config is loaded.

#7
[eluser]rideearthtom[/eluser]
In case anyone reads this in the future, it turns out that the problem was unrelated to CI. Firstly, exim was configured to reject emails with an unrecognised sender (so noreply@ was rejected), and secondly, iptables was blocking outgoing SMTP connections to the relay server.

The moral of this story is always hire a server admin who knows what they're doing Smile


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.