If you have mail server then you should use the wp_mail wordpress plugin. Information about Send email through wp_mail in html format with wordpress is easy. Emails are very important feature for now in the world so you need to understand better the wordpress mail functionality.

In wordpress we use the wp_mail function for sending email. Following parameters we use for wp_mail. WP developers wants to send email through wordpress.

Send email through wp_mail in html format with wordpress

Here is some brief and introduction about wp_mail method of wordpress. wordpress itself uses the PHPmailer for sending emails.


    (string or array) (required) The intended recipient(s). Multiple recipients may be specified using an array or a comma-separated string.

    (string) (required) The subject of the message.

    (string) (required) Message content.

    (string or array) (optional) Mail headers to send with the message. (advanced)

    (string or array) (optional) Files to attach: a single filename, an array of filenames, or a newline-delimited string list of multiple filenames. (advanced)

Simple example:

Solution code is Hidden! It's Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.
Send email through wp_mail in html format with wordpress

Send email through wp_mail in html format with wordpress

We can use this code for contact form or in functions.php file

For html format email from wordpress. we just need to add following line in functions.php file.

add_filter('wp_mail_content_type',create_function('', 'return "text/html";'));

Sending HTML email has risks. It could be caught in spam filters. The client may not support HTML formatting (although that’s rare). The client may disable email HTML from using javascript, CSS or grabbing remote assets like images.

Written by WPAPI

My name is Purab Kharat, Here is my Personal Blog: digcms.com. Work as an Senior Technical Lead at Smartsourcing Global Pvt Ltd in Princeton, NJ, USA. I contributor of many wordpress plugins and Drupal Modules. I am core developer of Drupal. Connect to purab on LinkedIn or Follow @purab on Twitter or Follow me on Google+ or Write Mail to purabdk@gmail.com or Chat with me on Skype : purabdk

This article has 1 comment

Leave a Comment

Your email address will not be published. Required fields are marked *