Jump to content

PHP: Mail bounces from mail sent FROM php?


justravis

Recommended Posts

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!

Link to comment
Share on other sites

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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.