Page 1 of 1

ensuring e-mails are sent

Posted: Thu Oct 30, 2003 8:18 am
by kujtim
can you help me to write a script for mail form thet ven I click a send butom want to be sure thet the email is posted

Posted: Thu Oct 30, 2003 8:43 am
by volka
what do you have until now?

Posted: Thu Oct 30, 2003 8:59 am
by kujtim
i have only a funksion thet is posting files to email

Posted: Thu Oct 30, 2003 9:05 am
by volka
  • there are two possible (major) error conditions
  • your local mta refuses to take the mail (php's mail() probably returns false)
  • any gateway on the way refused to deliver the mail (user/addr does not exist, relaying not allowed, whatsoever)
while the first case happens almost instantly (as mentiond php's mail function probably returns a failure) the second can occurs hours (any time) after the mail has been sent and some kind of mail (also hopefully) finds its route back to the sender to inform him/her/it that samething went wrong.
Which of the two cases do you want to cover?

Posted: Thu Oct 30, 2003 3:56 pm
by Fredix
From my point of view you can only check if the server has accepted your mail for delivering:

$gonna_be_delivered = mail();

The variable is boolean and contains either TRUE or FALSE.
See php.net/mail for more info.

I can't imagine how to solve the the second case volka mentioned, because you can not let a script run for hours to wait for some remote server response.....

Posted: Thu Oct 30, 2003 4:50 pm
by d3ad1ysp0rk
you could always send yourself a copy of the email

but that doesn't always mean they'd get it..