big-dog1965 Posted February 24, 2009 Share Posted February 24, 2009 How would I get this to send an email to someone else: as well as the current $useremail address. This does work but it only sends to the person that fills in the form that this is referenced from. I would like it to be coded in such a manner that in this file there would be and editable section that you put an email or a couple of emails in, to send to // DO NOT EDIT BELOW THIS LINE, UNLESS YOU KNOW WHAT YOU ARE DOING if ($username == "" or $userpass == "" or $useremail == ""){$msg3=true;} $email = $useremail; if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", $email)) { $msg4 = true; $pass = "no"; } if (!isset($useremail)) echo "Error, Please re-send $username" ; $todayis = date("l, F j, Y, g:i a") ; $subject = "Registration"; $message = " $todayis [EST] \n From: $sendersName \n \n Your user level will be set upon approval \n This email was sent by an auto responder, you cannot reply to this email. "; $from = "From: $sendersEmail"; if ($email != "") mail($email, $subject, $message, $from); Link to comment https://forums.phpfreaks.com/topic/146631-modding-a-email-send-php-file/ Share on other sites More sharing options...
sdi126 Posted February 24, 2009 Share Posted February 24, 2009 Just add another mail line after the current one to send another email: mail("[email protected],[email protected]", $subject, $message, $from); To send to multiple addresses you just seperate each one out by a comma. Link to comment https://forums.phpfreaks.com/topic/146631-modding-a-email-send-php-file/#findComment-769852 Share on other sites More sharing options...
Q695 Posted February 24, 2009 Share Posted February 24, 2009 sdi don't you mean: if ($email){ @mail($email, $subject, $message, $from); } you're checking to see if email is set also. Link to comment https://forums.phpfreaks.com/topic/146631-modding-a-email-send-php-file/#findComment-769899 Share on other sites More sharing options...
big-dog1965 Posted February 24, 2009 Author Share Posted February 24, 2009 I get an error Parse error: syntax error, unexpected '@' in /home5/public_html/App/Admin/db/send.php on line 31 is the email address line. if ($email != "") mail($email, $subject, $message, $from); if ($email){ [email protected],[email protected]. ($email, $subject, $message, $username, $useremail); } ?> Link to comment https://forums.phpfreaks.com/topic/146631-modding-a-email-send-php-file/#findComment-769902 Share on other sites More sharing options...
Q695 Posted February 24, 2009 Share Posted February 24, 2009 this: if ($email){ [email protected],[email protected]. ($email, $subject, $message, $username, $useremail); } should be like within the if statement: mail($to, $subject, $message, $headers); remove: if ($email != "") mail($email, $subject, $message, $from); Link to comment https://forums.phpfreaks.com/topic/146631-modding-a-email-send-php-file/#findComment-769934 Share on other sites More sharing options...
big-dog1965 Posted February 25, 2009 Author Share Posted February 25, 2009 Im not getting the above mentioned code to work. I looked at some tuts but still dont understand. Seems the if ($email != "") is working but sending to other emails just doesnt Link to comment https://forums.phpfreaks.com/topic/146631-modding-a-email-send-php-file/#findComment-771466 Share on other sites More sharing options...
Q695 Posted February 26, 2009 Share Posted February 26, 2009 doing a "if ($var)" checks to see if there is data there, or not. if ($email){ @mail($email, $subject, $message, $from); } Link to comment https://forums.phpfreaks.com/topic/146631-modding-a-email-send-php-file/#findComment-771565 Share on other sites More sharing options...
big-dog1965 Posted February 26, 2009 Author Share Posted February 26, 2009 but where do I include the other emails I want the result to go Link to comment https://forums.phpfreaks.com/topic/146631-modding-a-email-send-php-file/#findComment-771586 Share on other sites More sharing options...
Q695 Posted February 26, 2009 Share Posted February 26, 2009 They go within the $email variable, or you can put it on there in a while loop if you want it to loop through a mail script. see the following code // multiple recipients $to = '[email protected]' . ', '; // note the comma $to .= '[email protected]'; Link to comment https://forums.phpfreaks.com/topic/146631-modding-a-email-send-php-file/#findComment-771676 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.