Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've got a server with Plesk installed. On this I've got a website on a virtual domain which contains the PHP function mail. Due to some "problems" with Plesk, virtual domains and PHP mail: Plesk, SMTP and sending e-mail from same domain I've lost a lot of important e-mail due to the fact that they was not sent.

Is it somehow possible to recover those e-mail that wasn't sent because of the virtual domain issue?

share|improve this question
    
That depends on how you sent it and what sort of logging you have going on. If you used the PHP mail function, your server's Sendmail may have logged something. If you used SMTP, you would have to check with the server you sent the mail through to see if it logged the message. –  Tanoro Jan 10 '12 at 19:59
    
mail server logs\queue if your lucky, could ask admin upstream, but i would bet they gone forever. –  Dagon Jan 10 '12 at 20:09
2  
I think people over at serverfault might be able to help you. –  freddy K. Jan 10 '12 at 20:11
add comment

migrated from stackoverflow.com Jan 10 '12 at 22:28

This question came from our site for professional and enthusiast programmers.

1 Answer

Most probably the emails are lost. I suppose that email server rejected your message, so it is not in its queue. The only thing you can get from mailserver logs is the list of recipients.

Good programming practice is to check return values of called functions. If you use PHP mail() function, so should check if it returned true or false. If you use some library which uses SMTP for sending, it should also return you information about whether the mailserver accepted the message or not. Then you can log failed messages for example to database or dump them to a file, so that you won't loose the data you wanted to send. Or better - log all sent emails (for some amount of days). Using this, you will have more info available also in case someone tries to abuse/spam your system.

share|improve this answer
    
Do you know how to retrieve the list of recipients? That would be very helpful. –  user809829 Jan 21 '12 at 12:03
    
That depends on the mailserver used. The logs are usually in /var/log/mail.log on Unix systems, but the exact format of the log file depends on the mailserver. –  Marki555 Jan 23 '12 at 6:40
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.