Phpmailer simple mail sending method (with phpmailer source code download), phpmailer source code download _ PHP Tutorial

Source: Internet
Author: User
Tags email account
Phpmailer simple mail sending method (with phpmailer source code download), phpmailer source code download. Phpmailer simple mail sending method (with phpmailer source code download), phpmailer source code download this article example describes phpmailer simple mail sending method. Share it with you for your reference. you can use phpmailer to simply send emails (with phpmailer source code download) and phpmailer source code download.

This example describes how phpmailer simply sends emails. We will share this with you for your reference. The details are as follows:

First, click hereDownload from this siteCorresponding php file.

After decompression, there are 2 php files (2 classes) and 1 html file (API)

Put two php files in the php project

Brief description: here I use a 163 email to send a message to the 126 email address.

The key code is as follows:

<? Php require 'class. phpmailer. php '; $ mail = new PHPMailer (true); // Create a mail sending class $ mail-> CharSet = "UTF-8 "; // Set the encoding type of information $ address = "****** @ 126.com"; // recipient address $ mail-> IsSMTP (); // use SMTP to send $ mail-> Host = "smtp.163.com"; // use the 163 email server $ mail-> SMTPAuth = true; // enable the SMTP verification function $ mail-> Username = "****** @ 163.com "; // your 163 server email account $ mail-> Password = "******"; // 163 email Password $ mail-> Port = 25; // email server port $ mail-> From = "****** @ 16 3. com "; // email address of the sender $ mail-> FromName =" test email "; // sender name $ mail-> AddAddress (" $ address "," Zhang San "); // the recipient address, which can be replaced with any email address in the format of AddAddress ("recipient email", "recipient name") $ mail-> AddAttachment ("D: \ abc.txt "); // add an attachment (note: The path cannot contain Chinese characters) $ mail-> IsHTML (true ); // use the HTML format $ mail-> Subject = "test"; // mail Title $ mail-> Body = "Happy New Year"; // mail content, if HTML is set above, it can be HTML if (! $ Mail-> Send () {echo "failed to Send the email.

"; Echo" error cause: ". $ mail-> ErrorInfo; exit ;}?>

I hope this article will help you with php programming.

Pipeline (with phpmailer source code download), phpmailer source code download this example describes phpmailer simple mail method. Share it with you for your reference,...

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.