Jump to content

PHP Mail


Ell20

Recommended Posts

Hi,

 

I have set up a form on my site to invite users to the site.

I have set it up so there are 3 boxes to put in 3 different email addresses at a time, however I obviously only want to send the message to all 3 if all 3 boxes have an email address in.

 

I have tried using if and elseif to determine which $to statement to use but it dosent seem to be working.

 

Am I doing something wrong?

 

Cheers

Link to comment
Share on other sites

Sorry:

 

if (eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", stripslashes(trim($_POST['email1'])))) {
$e1 = escape_data($_POST['email1']);
} else {
$e1 = FALSE;
echo '<p><font color="red" size="+1">Please enter a valid email address!</font></p>';
}

if (!empty($email2)) {
if (eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", stripslashes(trim($_POST['email2'])))) {
$e2 = escape_data($_POST['email2']);
} else {
$e2 = FALSE;
echo '<p><font color="red" size="+1">Please enter a valid email address!</font></p>';
}
}
if (!empty($email3)) {
if (eregi ("^[[:alnum:]][a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$", stripslashes(trim($_POST['email3'])))) {
$e3 = escape_data($_POST['email3']);
} else {
$e3 = FALSE;
echo '<p><font color="red" size="+1">Please enter a valid email address!</font></p>';
}
}

if ($e1) {
$to = "$e1"; }
elseif ($e1 && $e2) {
$to = "$e1, $e2"; }
elseif ($e1 && $e2 && $e3) {
$to = "$e1, $e2, $e3"; }

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.