ensuring e-mails are sent

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kujtim
Forum Commoner
Posts: 35
Joined: Sat Oct 25, 2003 4:00 am
Location: kosovo
Contact:

ensuring e-mails are sent

Post 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
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

what do you have until now?
kujtim
Forum Commoner
Posts: 35
Joined: Sat Oct 25, 2003 4:00 am
Location: kosovo
Contact:

Post by kujtim »

i have only a funksion thet is posting files to email
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post 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?
User avatar
Fredix
Forum Contributor
Posts: 101
Joined: Fri Jul 18, 2003 2:16 pm
Location: Wehr (Eifel) Germany
Contact:

Post 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.....
d3ad1ysp0rk
Forum Donator
Posts: 1661
Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA

Post by d3ad1ysp0rk »

you could always send yourself a copy of the email

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