Written by me@grafxflow
02 Oct, 2008
0
2,079
Here is the basic code which will allow you to embed html inside an email, with the use of php.
<?php
$from_email = "From: from_email_address\n";
$from_email .= "Content-Type:text/html; charset=\"iso-8859-1\"\n";
$subject = "Form confirmation email";
$message = "<html content to go here code>";
$send_to = "to_email_address";
mail($send_to, $subject, $message, $from_email);
?>
Here is another version including other settings such as Bcc, Urgent Message for reference:
<?php
$from_email = "From: from_email_address\n";
$from_email .= "X-Sender: from_email_address\n";
$from_email .= "X-Mailer: PHP\n"; // mailer
$from_email .= "X-Priority: 1\n"; //1 Urgent Message, 3 Normal
$from_email .= "Content-Type:text/html; charset=\"iso-8859-1\"\n";
$from_email .= "Bcc:user1@example.com, user2@example.com\n";
$from_email .= "Cc:user1@example.com, user2@example.com\n";
$subject = "Form confirmation email";
$message = "<html content to go here code>";
$send_to = "to_email_address";
mail($send_to, $subject, $message, $from_email);
?>
23 Apr, 2018
24 Nov, 2013
07 Nov, 2012
I am a Full-stack Developer who also started delving into the world of UX/UI Design a few years back. I blog and tweet to hopefully share a little bit of knowledge that can help others around the web. Thanks for stopping by!
Follow11 Jul, 2023
21 Jun, 2023
Views: 166,590
Views: 40,466
Views: 37,234
Views: 33,737