Jump to content

[SOLVED] Email script and adding additional email address to send to???


craigtolputt

Recommended Posts

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]';
	}

 

$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 :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.