tags:

views:

232

answers:

2

I have a script that uses PHP mail() function to send emails:

mail("[email protected]", "Subject", "Message");

Everything worked fine until yesterday. Now the mails either end up in a dead.letter file or just don't get sent.

What could be the reason for this? Any hints into how do I debug such code?

+1  A: 

If it's all the same to you I'd suggest using something like SwiftMailer instead of php's built-in mail() function.

Anyway, does your MTA give you a reason for the dead.letter? You might find clues in the file /var/log/maillog (depending on your server/MTA configuration).

VolkerK
+1  A: 

When sendmail can't send mail, it saves the message in a file named "dead.letter". Your sendmail is probably misconfigured or not running at all.

Edit: you may want to inspect /var/log/maillog to check for debug info from sendmail.

diciu