Change the email content type to HTML
Sending emails in WordPress requires the wp_mail() function, but the default type of email content is "text/plain", which means HTML is not supported.
If you want to add HTML code to the email content, in addition to sending the headers information of "Content-Type: text/", you can also use filters to modify it uniformly.
/** *WordPress Change the email content type to HTML */mail-content-type-html/ */ function Bing_set_html_content_type_html(){ return 'text/html';//Can customize the type} add_filter( 'wp_mail_content_type', 'Bing_set_html_content_type_html' );
In this way, the content of the mailbox supports HTML code by default.
Customize email sending and sending
When using the SMTP plug-in, you can customize the sender and email of the email. There is a problem here. How to customize the sender and email of the email if you do not use the SMTP plug-in?
By default, the sender is "WordPress < wordpress@ >", so that the user cannot reply directly, and it is easily judged as spam, resulting in the user not receiving it.
If you want to modify the sender and sender email, you only need to use a small piece of code and put it in (Learn more):
/** *WordPress Custom email sending and sender */change-mail-from-info/ */ //Senderfunction Bing_wp_mail_from_name(){ return 'Binguo';//Can be modified by yourself} add_filter( 'wp_mail_from_name', 'Bing_wp_mail_from_name' ); //Send emailfunction Bing_wp_mail_from(){ return 'admin@';//Can be modified by yourself} add_filter( 'wp_mail_from', 'Bing_wp_mail_from' );