craigtolputt Posted September 30, 2009 Share Posted September 30, 2009 Hi Guys, I have an online form which sends an email detailing the users request. There is a drop down box with 4 options and depending on what the user chooses it will send the email to a different email address. so for example if they choose Weddings then the email gets sent to weddings@ and if they choose Business then the email gets sent to sales@. What i need to do is also send a copy of the email to info@ aswell. heres my code: if($interest == 'Membership'){ $address = '[email protected]'; } else if($interest == 'Events'){ $address = '[email protected]'; } else if($interest == 'Business'){ $address = '[email protected]'; } else if($interest == 'Weddings'){ $address = '[email protected]'; } can i just do this: if($interest == 'Membership'){ $address = '[email protected]' && '[email protected]'; } else if($interest == 'Events'){ $address = '[email protected]' && '[email protected]'; } else if($interest == 'Business'){ $address = '[email protected]' && '[email protected]'; } else if($interest == 'Weddings'){ $address = '[email protected]' && '[email protected]'; } Link to comment https://forums.phpfreaks.com/topic/176029-solved-email-script-and-adding-additional-email-address-to-send-to/ Share on other sites More sharing options...
trq Posted September 30, 2009 Share Posted September 30, 2009 can I just do this: No, but you could do.... $address = '[email protected], [email protected]'; Link to comment https://forums.phpfreaks.com/topic/176029-solved-email-script-and-adding-additional-email-address-to-send-to/#findComment-927532 Share on other sites More sharing options...
Yesideez Posted September 30, 2009 Share Posted September 30, 2009 $address=''; switch ($interest) { case 'Membership': $address='[email protected]'; break; case 'Events': $address='[email protected]'; break; case 'Business': $address='[email protected]'; break; case 'Weddings': $address='[email protected]'; break; } if (!empty($address)) { mail($address,$subject,$message,$headers); } mail('[email protected]',$subject,$message,$headers); That way the email will only get sent to those in the switch statement if one of the cases match and an extra email will always be sent to info. EDIT: thorpe's got a much better idea Link to comment https://forums.phpfreaks.com/topic/176029-solved-email-script-and-adding-additional-email-address-to-send-to/#findComment-927534 Share on other sites More sharing options...
craigtolputt Posted September 30, 2009 Author Share Posted September 30, 2009 nice one thanks guys. Link to comment https://forums.phpfreaks.com/topic/176029-solved-email-script-and-adding-additional-email-address-to-send-to/#findComment-927535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.