Hi, I've got this nice little sales tool/form written where I can drop email addresses into my webform and automatically send an HTML email, but I want to have the option to send a different html body using a drop-down option. For example, if I want to send a "general introduction" email, I can choose "general" from my drop-down and it will send that email, or if I want to send a "follow-up," it will send that email, etc. I am having trouble with the PHP call-to-action of which email to send. I already have it worked out so it will send only one type of email and that's by wrapping this php around the one html message. I think I am missing an ifelse command, and I also need to know call the different html emails (do I use "require_once"?). This is what I have so far.
Before anyone says it, I know there are already programs written like this that I can buy or services to which I can subscribe, but I want to write my own (with a little help, of course).
<?php
$from = $_POST['from'];
$to = trim($_POST['contacts']);
$to = $_POST['contacts'];
$subject = $_POST['subject'];
$random_hash = md5(date('r', time()));
$headers = "From: $from\r\nReply-To: $from";
$headers .= "\r\nContent-Type: multipart/alternative; boundary=\"PHP-alt-".$random_hash."\"";
ob_start();
?>
--PHP-alt-<?php echo $random_hash; ?>
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 7bit
//This is where I would need the body options
<?php
$message = $body;
$body = $_POST['email_body'];
$email_body = $awards = ('/awards.html'); //this is where I lose it
$general = ('/general.html');
$digital = ('/digital.html');
$retail = ('/retail.html');
$followup = ('/followup.html');
?>
--PHP-alt-<?php echo $random_hash; ?>--
<?
//copy current buffer contents into $message variable and delete current output buffer
$message = ob_get_clean();
//send the email
$mail_sent = @mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed"
echo $mail_sent ? "Mail sent" : "Mail failed";
?>
Thanks for any help in advance!
GJ