Pages

Send HTML Emails With wp_mail Function in Wordpress

WordPress allows you to send emails from your current website. The name of function is wp_mail(). However, All mails are of plain text and do not allow HTML in the email. If you want to send a HTML formatted email, then you need to change the content of emails' type to 'text/html'. So, To complete this stuff we are going to use the wp_ mail_ content_ type filters.

HTML Emails With wp_mail Function in Wordpress

Write below code in your functions.php file to change the content type to HTML.

 //Send HTML emails in WordPress Using wp_mail function
add_filter( 'wp_mail_content_type', 'set_content_type' );
function set_content_type( $content_type ){
return 'text/html';
}

ethan

Phasellus facilisis convallis metus, ut imperdiet augue auctor nec. Duis at velit id augue lobortis porta. Sed varius, enim accumsan aliquam tincidunt, tortor urna vulputate quam, eget finibus urna est in augue.

No comments:

Post a Comment