Change the message content type to HTML
In WordPress
Send mailYou need to use the Wp_mail () function, but the default type of message content is "Text/plain", that is, HTML is not supported.
If you want to add HTML code to the message content, you can also use the filter to change the headers information in addition to the "content-type:text/".
/** *wordpress Change the message content type to HTML *http://www.endskin.com/mail-content-type-html/*/function Bing_set_html_ Content_type_html () { return ' text/html ';//Can be custom type}add_filter (' Wp_mail_content_type ', ' Bing_set_html_content_ Type_html ');
In this way, the contents of the mailbox support HTML code by default.
Customize message sending and senders
When using the SMTP plugin, you can customize the message sender and mail, here is a problem, if you do not use the SMTP plug-in how to customize the message sender and the sender mailbox?
By default, the sender is "WordPress < wordpress@example.com >" So the user cannot reply directly and is easily judged as spam, resulting in the user not receiving it.
If you want to modify the sender and sender mailboxes, just use a small piece of code and put it in functions.php (Learn more):
/** *wordpress Custom mail message and sender *http://www.endskin.com/change-mail-from-info/*///sender function Bing _wp_mail_from_name () { return ' bin fruit ';// can modify}add_filter (' Wp_mail_from_name ', ' bing_wp_mail_from_name '); Send mail function bing_wp_mail_from () { return ' admin@endskin.com ';//self-modifying}add_filter (' Wp_mail_from ', ' bing_wp _mail_from ');
The above describes some of the mail in WordPress, some of the changes and customization skills, including the content of the e-mail, I hope the PHP tutorial interested in a friend helpful.