Hi all
I’m working on a basic html php form which collects data, validates, and then sends a small message to the collected email address once submitted and stored in the database, working good.
The snippet I need help with is below. Instead of sending a small message, I need to some how send a full html email to the email address I collected. Using the data below, how would I do that?
Is it possible to send email-template.html as the message, what is the best way?
// No errors, email the details
if (strlen($s_error_message) == 0)
{
$to="barry@example.com";
$message = "Sender: "
. $first_name . ' '
. $surname . "\n"
. $email . "\n\nPlease send my colleague, "
. $colleagues_first_name . ", a Email.\n" . $colleagues_email;
$subject = "Please send my colleague an email";
if (mail($to, $subject, $message, 'From: ' . $email)) {header('Location: https://example.com');}
else {print('There was a problem sending the mail. Please check that you filled in the form correctly.');}
}
Thanks, Barry