Jump to content

Recommended Posts

I have a function that sends a short email to people who have signed up for the service.  Unfortunately, some people do not sign up with valid email addresses, and these seem to cause my loop to fail without mailing those who have valid addresses.  Any ideas?

 

foreach($address_arr as $address) {
         $success = mail($address,'Open Shift',$body,'From: DCEMS');
         if ($success)
            $success_arr[] = "Successful notification: " . $address;
         else
            $_ERROR[] = "Failed notification: " . $address;
      }

You can use checkdnsrr for a valid MX record. I use this to validate email addresses. This way at least a person will HAVE to put in a valid domain, even if it is not actually their email address.

<?php

if(checkdnsrr('yahoo.com' )) {
  echo 'MX record was found';
}
?>

 

Nate

  • 2 weeks later...

Chronister: thanks much.  I used this, and it increased the number of emails sent, though I'm still not quite at 100%.  After talking with US Cellular (most of the addresses failing were their SMP addresses), I think it's an issue of them accepting the messages. <shrug>

 

Thanks again.

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.