Linux sends HTML format messages, mailboxes do not receive HTML formatting problems

Source: Internet
Author: User

Problem:

When you use Linux to send mail, sometimes you want to send HTML-formatted mail, if you find the HTML message sent, but the contents of the mailbox received or pure TXT format.


Reason:

Linux uses the Mail function to send the header parameter to be added, specifying the send content as txt/html


Solve:

1. Send a message test using the command line

You can send a message by executing the following code on the Linux command line

echo "<b><div style= ' color:red ' >html message goes here</div></b>" | Mail-s "$ (echo-e" This is the subject\ncontent-type:text/html ")" 332800462@qq.com



2. When sending using the Mail method in a PHP function, you need to specify the header parameter to send

<?php

$to = "somebody@example.com, somebodyelse@example.com";
$subject = "HTML email";

$message = "


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.