- This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Hi all –
I took the simpleform from the site and have modified it a bit to allow the user to choose who receives the email.
I also wanted to add a ‘CC’ if possible.
Here is the code:
// prepare email body text
$Body = “”;
$Body .= “Name: “;
$Body .= $Name;
$Body .= “n”;
$Body .= “Tel: “;
$Body .= $Tel;
$Body .= “n”;
$Body .= “Email: “;
$Body .= $Email;
$Body .= “n”;
$Body .= “Message: “;
$Body .= $Message;
$Body .= “n”;
// send email
$success = mail($EmailTo, $Subject, $Body, “From: <$EmailFrom>“);
// redirect to success page
if ($success){
print ““;
}
else{
print ““;
}
?>
I added this little snippet as i thought it may send the second email, but it didn’t work.
Maybe I should just modify the ‘$EmailTo’ variable, but i’m not too proficient in php.
if you want to carbon copy just do this:
// redirect to success page
if ($success){
//copy to someone else
mail([email protected], $Subject, $Body, “From: <$EmailFrom>“);
print ““;
}
All you need to do is pass the CC in the last variable of mail();
Enjoy,
Sorry about the double post, but I forgot to mention.
It’s good practice to always send the email from the domain that your server is on and use a replyto instead.