justravis Posted August 27, 2007 Share Posted August 27, 2007 I wrote an email testing script. The from address is one of my email addresses. I hoped that if the email address did not exist, I would receive a bounced message, but that is not happening. Ideas? thanks. Quote Link to comment https://forums.phpfreaks.com/topic/66888-php-mail-bounces-from-mail-sent-from-php/ Share on other sites More sharing options...
Illusion Posted August 27, 2007 Share Posted August 27, 2007 we can't imagine what u have written there, so post the code. Quote Link to comment https://forums.phpfreaks.com/topic/66888-php-mail-bounces-from-mail-sent-from-php/#findComment-335294 Share on other sites More sharing options...
justravis Posted August 27, 2007 Author Share Posted August 27, 2007 I SINCERELY apologize...dont kno wut i was thinking <?php $perday=4; $inc=24/$perday; $timeadjusted=mktime(date('H')-2); #Midnight outputs as 0, but for the purpose of the if statement, it seems to be valued at 24 if(!(date('H', $timeadjusted)%$inc) || $_GET[skiptime]) { $emails=array('noemail@poweron.com','support@poweron.com', 'travis@poweron.com', 'travis@jt.com', 'travis@rtb.cc', 'travis@sdsoccer.org'); #$emails=array('support@powerontechnologies.com', 'travis.perreira@powerontechnologies.com', 'travis@justravis.com', 'travis@raise-the-bar.cc', 'trav is@sdwcsoccer.org'); echo "<u>Email Addresses Tested:</u><br />\n"; $subject='Email Test - ' . date('H:i \o\n l, F d, Y', $timeadjusted); $body='Test from ' . gethostbyaddr($REMOTE_ADDR); $from='From: emailtest@powerontechnologies.com'; foreach($emails AS $to) { echo "$to - "; if(mail($to, $subject, $body, $from)) { echo "test email sent<br />\n"; } else { echo "error occured<br />\n"; } } } else { echo date('H', $timeadjusted) . "%$inc=" . date('H', $timeadjusted)%$inc; } ?> Any Ideas? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/66888-php-mail-bounces-from-mail-sent-from-php/#findComment-335782 Share on other sites More sharing options...
Illusion Posted August 28, 2007 Share Posted August 28, 2007 mail($to, $subject, $body, $from,-f $from) Quote Link to comment https://forums.phpfreaks.com/topic/66888-php-mail-bounces-from-mail-sent-from-php/#findComment-336014 Share on other sites More sharing options...
ReDucTor Posted August 28, 2007 Share Posted August 28, 2007 PHP's mail function returns true if its accepted for delivery, which the only way it isnt is if you dont have sendmail or pop settings setup. So do not rely on this for validating if an email was successfully received. I suggest if you want to detect bouncing send emails to your self using the Errors-To header. $subject='Email Test - ' . date('H:i on l, F d, Y', $timeadjusted); $body='Test from ' . gethostbyaddr($REMOTE_ADDR); $from='From: emailtest@powerontechnologies.com'; $errorsto = 'Errors-To: webmaster@powerontechnologies.com'; if(mail($to, $subject, $body, $from."\r\n".$errorsto)) If you want to get into automated systems you will need to check your SMTP server and what sort of scripts you can have process incoming emails, and then you can also make use of Message-ID header if you really want to track it down quicker. But unless you have large mailing lists automated systems for bounced emails arent that neccessary Quote Link to comment https://forums.phpfreaks.com/topic/66888-php-mail-bounces-from-mail-sent-from-php/#findComment-336025 Share on other sites More sharing options...
justravis Posted August 28, 2007 Author Share Posted August 28, 2007 exactly, i want errors emailed to me. i added the errorto header, but i hav not received any bounce emails. thanks for yr time, travis Quote Link to comment https://forums.phpfreaks.com/topic/66888-php-mail-bounces-from-mail-sent-from-php/#findComment-336357 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.