Jump to content

[SOLVED] Drop Down Email Sending.


johnmark

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="[email protected]">Chris</option>
  <option value="[email protected]">Sean</option>
</select>
</form>

 

PHP send code:

 

<?
$mailfrom = "[email protected]";
$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 :)

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.