Jump to content

Recommended Posts

Hello,

 

I want to create a drop down list that has multiple emails in it, that when one is selected, after the form is filled out it will be sent to that email. I have searched around but haven't found the solution. I can see it in my head just can't get it out. If you could give me a link that applies to this, or even an easy code... I would be very grateful.

 

Thank You for the help.

 

John

Link to comment
https://forums.phpfreaks.com/topic/64826-solved-drop-down-email-sending/
Share on other sites

email form:

 

<form action="send.php" method="post">
<select name="emailto">
  <option value="chris@place.com">Chris</option>
  <option value="sean@place.com">Sean</option>
</select>
</form>

 

PHP send code:

 

<?
$mailfrom = "from@address.co.za";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: $mailfrom\r\n";

$msg = "Hello World";

$recipient .= $_POST['emailto'];

$subject = "Subject";
mail($recipient, $subject, $msg, $headers);
echo "Your mail has been successfully sent.";
?>

 

Enjoy :)

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.