<?php require './PHPMailer-master/PHPMailerAutoload.php'; $mail = new PHPMailer; //$mail->SMTPDebug = 3; // 关闭SMTP调试功能 1 = error // Enable verbose debug output $mail->isSMTP(); // 使用SMTP服务 // Set mailer to use SMTP $mail->Host = 'smtp.163.com'; // 发送方的SMTP服务器地址 // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'xxxxxxx@163.com'; // 发送方的163邮箱用户名 // SMTP username $mail->Password = 'xxxxx'; // 发送方的邮箱密码,注意用163邮箱这里填写的是“客户端授权密码”而不是邮箱的登录密码! // SMTP password $mail->SMTPSecure = 'ssl'; // 使用ssl协议方式 // Enable TLS encryption, `ssl` also accepted $mail->Port = 994; // 163邮箱的ssl协议方式端口号是465/994 // TCP port to connect to $mail->CharSet = "utf8"; // 编码格式为utf8,不设置编码的话,中文会出现乱码 $mail->SMTPAuth = true; // 是否使用身份验证 $mail->setFrom('xxxxxxx@163.com', 'myafa'); // 设置发件人信息,如邮件格式说明中的发件人,这里会显示为Mailer(xxxx@163.com),Mailer是当做名字显示 $mail->addAddress('11111@aliyun.com', '老铁'); // 设置收件人信息// Add a recipient $mail->addAddress('22222@qq.com', '老铁'); // 设置收件人信息, $mail->addAddress('xxxxxxx@163.com', '老铁'); // 设置收件人信息, //$mail->addAddress('ellen@example.com'); // Name is optional //$mail->addReplyTo('info@example.com', 'Information'); // 设置回复人信息,指的是收件人收到邮件后,如果要回复,回复邮件将发送到的邮箱地址 //$mail->addCC('cc@example.com'); // 设置邮件抄送人,可以只写地址,上述的设置也可以只写地址 //$mail->addBCC('bcc@example.com'); // 设置秘密抄送人 //$mail->addAttachment('/var/tmp/file.tar.gz'); // 添加附件// Add attachments $mail->addAttachment('/61e8a1fdly1fcpvyl7dkzg20bi06d7wk.gif', '你.jpg'); // 添加附件// Optional name $mail->isHTML(true); // Set email format to HTML
This is a very easy-to-use email class. The usage methods have been posted above. Friends who need it can download and use it directly
All resources on this site are contributed by netizens or reprinted by major download sites. Please check the integrity of the software yourself! All resources on this site are for learning reference only. Please do not use them for commercial purposes. Otherwise, you will be responsible for all consequences! If there is any infringement, please contact us to delete it. Contact information: admin@php.cn
Related Article
13Jul2016
PHPMailer mail class mail is sent. We use a foreign open source mail class for this email sending function. The PHPMailer mail class that you may have used is very simple. Today I will talk about a simple usage tutorial. If you need it
12Jul2017
This article mainly introduces the usage of PHPMailer for sending PHP emails. It details the installation and configuration methods and function implementation code. It is of great practical value. Friends who need it can refer to it.
06Aug2023
How to use PHP to connect the mail class to implement scheduled mail sending function? With the rapid development of the Internet, email has become an indispensable way of communication in people's daily life and work. For some specific needs, such as sending emails regularly, you need to use PHP to connect to the email class. As a powerful back-end development language, PHP has a wealth of extension libraries and third-party libraries, including many email libraries. Today we will introduce how to use a commonly used email library to implement the scheduled email sending function. head
21Jul2016
The PHPMailer email class uses the smtp.163.com method to send emails. Step 1: You need to download the PHPMailer file package phpmailer-1.73.tar.gz from the open source community: http://phpmailer.sourceforge.net/ Step 2: Confirm that your server system supports socket, as shown below
06Aug2023
How to use PHP to connect the mail class to implement the mass mail function? With the development of the Internet, email has become one of the indispensable communication tools in people's daily life and work. Sometimes we need to send emails to a large number of users or subscribers, and manually sending them one by one is obviously too inefficient. As a commonly used server-side scripting language, PHP can realize the mass mailing function by docking with the mail class library. In PHP, commonly used email libraries include PHPMailer and SwiftMailer. Both libraries provide a rich
25Jul2016
Example of sending emails using PHPMailer mail class (163 mailbox)
Hot Tools
PHP library for dependency injection containers
PHP library for dependency injection containers
A collection of 50 excellent classic PHP algorithms
Classic PHP algorithm, learn excellent ideas and expand your thinking
Small PHP library for optimizing images
Small PHP library for optimizing images