How to Send HTML Email or HTML Code page
Sending HTML Email:
When you send a text message using PHP then all the content will be treated as simple text. Even if you will include HTML tags in a text message, it will be displayed as simple text and HTML tags will not be formatted according to HTML syntax. But PHP provides option to send an HTML message as actual HTML message.
While sending an email message you can specify a Mime version, content type and character set to send an HTML email.
Sending HTML Email Code Example
<html> <head> <title>Sending email using PHP</title> </head> <body> <?php $to = "xyz@somedomain.com"; $subject = "This is subject"; $message = "This is HTML message."; $message .= "This is headline.
"; $header = "From:abc@somedomain.com \r\n"; $header = "Cc:afgh@somedomain.com \r\n"; $header .= "MIME-Version: 1.0\r\n"; $header .= "Content-type: text/html\r\n"; $retval = mail ($to,$subject,$message,$header); if( $retval == true ) { echo "Message sent successfully..."; } else { echo "Message could not be sent..."; } ?> </body> </html>
How to Send HTML Email or HTML Code page
Reviewed by Rajat Jha
on
09:50:00
Rating:
Nice and good post. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information.
ReplyDeletePhp Web Development Company Bangalore | Ecommerce Website Designer In India | Internet Marketing Company in Bangalore | Ecommerce Website Company In Bangalore