views:

64

answers:

2

We recently had the problem that important timed emails could not be sent by the mailserver but the Zend_Mail send() function didn't return false since the email was successfully delivered to the mailserver.

In our situation the mail cue was jammed up due to some thousends of non sendable emails produced by a couple of cron jobs.

How can we communicate to the server and get some sort of response which tells us that the email was sent.

This is not about bouncing because we don't care, if the emails can be delivered, we just care that it can be sent.

+1  A: 

I think this is down to your mail server and whatever notification functions it has, there's little to be done on the PHP end. I'm no sysadmin but I think in a normal Linux/Unix setup, notification about such failures will go into the root mailbox or syslog, won't they?

Pekka
so we could parse such a log and see if there is a respective entry?! the mail log would probably also help.
tharkun
On a Linux system it seems to be called `/var/log/maillog` check http://linuxtopia.org/ProblemSolutions/smtp_port_25_timeout.html and http://www.hypexr.org/linux_mail_server.php
Pekka
+2  A: 

i'm not a sysadmin, but depending on your mailserver i think you could intercept those mails and send/pipe them back to your zend framework application. for example on postfix i think you could do this in an after queue content filter http://www.postfix.org/FILTER_README.html

roman
you mean like piping a copy back and if I recieve it set the flag that the mail has been sent? how would I recieve the email with ZF?
tharkun
zend_mail hase receive functionality if i remember correctly
roman
then we could also just bcc ourselves and recieve that mail with ZF and do the whole thing this way. this would actually be a very good solution as far as I can see.
tharkun
if the error is on your server, bcc would work too. it would not work if mails get bounced by the receiving mailserver
roman
yes, the mailserver runs on the same server I think. thanks for the hints.
tharkun