Advertisement

07.08.2008 at 11:26PM PDT, ID: 23549229
[x]
Attachment Details

How to know mail() function of PHP is OK or NOT (send mail successful or NOT?)

Asked by star6868 in PHP Scripting Language, SendMail Email Server, Email Servers

I use following PHP script to send mail:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>

It send mails OK, but sometime it can NOT send mail. I view mail log, and I see the result of send mail (in /var/log/maillog) , for example:

Jul  7 09:15:23 localhost postfix/smtp[32513]: A87A952DC9: to=<testmailabc82@yahoo.com.vn>, relay=none, delay=1, status=deferred (connect to mta-v1.mail.vip.sg1.yahoo.com[124.108.116.72]: server refused to talk to me: 421 Message from (.....MY SERVER IP..) temporarily deferred - 4.16.50. Please refer to http://help.yahoo.com/help/us/mail/defer/defer-06.html  )

I have a question: how to know the result of sendmail immediatly after  mail() function of PHP?
Or if have other solution to check mail is deliveried of NOT with PHP code?
(I also have my dedicated MailServer)

Start Free Trial
 
Loading Advertisement...
 
[+][-]07.09.2008 at 12:22AM PDT, ID: 21961232

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, SendMail Email Server, Email Servers
Sign Up Now!
Solution Provided By: ravenpl
Participating Experts: 3
Solution Grade: B
 
 
[+][-]07.09.2008 at 12:24AM PDT, ID: 21961241

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]07.09.2008 at 01:20AM PDT, ID: 21961460

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628