sniperscope Posted February 14, 2009 Share Posted February 14, 2009 Hi gurus, How can i be sure mail() function is really delivered or not ? So far my program send mail to all my mail list but some of these mail addresses are not using anymore. So i want to check which mail was delivered successfully. ? Regards Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/ Share on other sites More sharing options...
drisate Posted February 14, 2009 Share Posted February 14, 2009 You can only know if the mail() function worked ... after that it depens on the mail server that catches it ... Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-761896 Share on other sites More sharing options...
sniperscope Posted February 14, 2009 Author Share Posted February 14, 2009 I have some dump date in my mysql table and i have one real record(my mail address) and it says "Mail was sent successfully" but actually there is aaa@bbb.com.jp (which there is not such mail address) here is my code so far. do{ $mail = $row_r['mail']; $sending = mail($mail, $mail_header, $body, $header); if($sending != 1){ $flag = 1; $query_update = "UPDATE mail_mag SET err = '$flag' WHERE mail = '$mail'"; $r_update = mysql_query($query_update, $myconn) or die(mysql_error()); } } while ($row_r = mysql_fetch_array($r)); Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-761898 Share on other sites More sharing options...
Zane Posted February 14, 2009 Share Posted February 14, 2009 You know all those times when you register to a place and don't want to put your real e-mail...so you put in jkdkdfjkl@gobbledygoop.pop Well, if the mail() function was able to check the validity of an e-mail instantaneous...we wouldn't be able to do such things. The only way around it is to set up a confirmation e-mail script. Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-761900 Share on other sites More sharing options...
sniperscope Posted February 14, 2009 Author Share Posted February 14, 2009 But i know somehow it is possible with perl/cgi. Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-761906 Share on other sites More sharing options...
Zane Posted February 14, 2009 Share Posted February 14, 2009 Well you second option to this fiasco here is to waste resources trying to be secure. You can strip the email of the domain.....PING it and throw an error if the domain is not valid. You can check the main part of the domain for verification.. i.e the dot com area. Make sure it's a valid ICANN suffix. (.com, .net, .biz .tv ...etc, etc etc) You could make the user type their email several times so they don't just type random characters...with an @ symbol Either way though....unless you have them confirm by a link that they received the email....there is no way to tell if the email is real. Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-761913 Share on other sites More sharing options...
sniperscope Posted February 14, 2009 Author Share Posted February 14, 2009 Thanks for suggestion. I think i have to send a confirmation mail, this will be painless. Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-761927 Share on other sites More sharing options...
Daniel0 Posted February 14, 2009 Share Posted February 14, 2009 Well you second option to this fiasco here is to waste resources trying to be secure. You can strip the email of the domain.....PING it and throw an error if the domain is not valid. You can check the main part of the domain for verification.. i.e the dot com area. Make sure it's a valid ICANN suffix. (.com, .net, .biz .tv ...etc, etc etc) You could make the user type their email several times so they don't just type random characters...with an @ symbol Either way though....unless you have them confirm by a link that they received the email....there is no way to tell if the email is real. You can also check if the domain name in question has valid MX records using a DNS lookup. getmxrr Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-761971 Share on other sites More sharing options...
sniperscope Posted February 16, 2009 Author Share Posted February 16, 2009 then how mail services works ? if i send some mail via hotmail or gmail or any other mail service it returns me with an error report if my mail fail ? Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-763120 Share on other sites More sharing options...
trq Posted February 16, 2009 Share Posted February 16, 2009 then how mail services works ? if i send some mail via hotmail or gmail or any other mail service it returns me with an error report if my mail fail ? And so will your mail server used by php. Its just not instantaneous, you also may not even have access to the mail logs. If you have root shell access you can take a look at the mail logs (usually kept within /var/log somewhere), otherwise you might look for a dead.letter file within your ~/ directory. Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-763205 Share on other sites More sharing options...
angelcool Posted February 16, 2009 Share Posted February 16, 2009 I use PHPMailer, and my advise is you at least should give it try. I do not why I have issues with mail(), I guess because my understanding is that you have to be running a MTA (SMTP server) locally, maybe someone could confirm this though. Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-763248 Share on other sites More sharing options...
trq Posted February 16, 2009 Share Posted February 16, 2009 I use PHPMailer, and my advise is you at least should give it try. I do not why I have issues with mail(), I guess because my understanding is that you have to be running a MTA (SMTP server) locally, maybe someone could confirm this though. This is usually the case yes. php's mail function does not support authorization so connecting to a remote smtp server is more difficult. Quote Link to comment https://forums.phpfreaks.com/topic/145161-is-mail-delivered/#findComment-763252 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.