I am trying to use the mail() function to send an email from a user submitted form. My form has 2 inputs, a standard 1 line text field that I use as $mailto and a textarea form control that I use as $message. The script resolves to print my success message, but no email gets sent. I suspect it\'s because of the input from the textarea form control. Do I need to format this in some special way? Here is my script:
$mailto = $var_email;
$delim = \"\t\";
$keep_blanks = TRUE;
$subject = \"subject goes here\";
if (!$action) {
$action = \'mail\';
}
if ($action == \'mail\' && !$from) {
$from = ($contact_email);
}
if ($action == \'mail\' && !$message) {
$comments = $message;
}
if ($action == \'mail\' && !$mailto) {
die ( \"No mailto is specified! If you want the form to email the results, then
you must specify a mailto variable so that they get sent somewhere.\");
}
if ($action == \'mail\') {
mail(\"$mailto\", \"$subject\", \"$comments\", \"From: $from\");
print(\"<font face=\'arial, helvetica, sans-serif\'>\");
print(\"Your message has been sent\");
print(\"</font>\");
}