About the SMTP class and an example

Source: Internet
Author: User
Tags base64
Because of the display, there are some spaces in the post that have been removed, causing some errors to be used.
The analysis is as follows:
1, because of inadvertently modified, we get such a very good class, always want to change to look comfortable. But I need to be reminded that in this program, sometimes adding or removing several spaces can cause a program error.
2, now I will send up a number of procedures to explain some of the issues.
Content-type: There are several spaces in front of the next 1-2 lines. Please Add. The spaces in front of each line in the HTML are not displayed, so there is nothing in the post.
This is a friend of the previous post of content, I modified as follows:
This is a multi-part message in MIME format.
--=====_1__=====
content-type:multipart/alternative;
boundary= "=====_2__====="
--=====_2__=====
Content-type:text/plain;
charset= "GB2312"
Content-transfer-encoding:base64
x+vkudpd1qez1khutuwguphkvbxe08q8/sjtvp7atllpv7s4w9pkvp4=
--=====_2__=====
content-type:text/html;
charset= "GB2312"
Content-transfer-encoding:base64
pgh0bww+pghlywq+pc9ozwfkpjxib2r5pjxomt7a/dftpc9omt48l2jvzhk+pc9odg1spg==
--=====_2__=====--
--=====_1__=====--
Here's an example:
Actually, it's very simple.
$sender = new SMTP ();
$fromname = "Sony";
$frommail = "sonymusic@china.com";
$toname = "Pbabi";
$tomail = "Panbei@163.net";
$subject = "an example";
$text _body= "Please use the HTML-enabled mail software to view the message";
$html _body.= "$send _ok= $sender->send ($fromname, $toname, $frommail, $tomail, $subject, $text _body, $html _body);

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.