Some of the changes and customization techniques of mail in WordPress

Source: Internet
Author: User
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.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.