Home PHP Libraries Other libraries PHPMailer-master mail class
PHPMailer-master mail class
<?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

Disclaimer

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

How Do I Link Static Libraries That Depend on Other Static Libraries? How Do I Link Static Libraries That Depend on Other Static Libraries?

13 Dec 2024

Linking Static Libraries to Other Static Libraries: A Comprehensive ApproachStatic libraries provide a convenient mechanism to package reusable...

Why Can\'t I Send Mail Using PHP Mail() or PHPMailer? Why Can\'t I Send Mail Using PHP Mail() or PHPMailer?

22 Oct 2024

This article discusses the issue of a confounding error: "Could not instantiate mail function" when attempting to resolve a mailing issue from a PHP script. The root cause is identified as a corrupted class.phpmailer.php file, which can be

How to Troubleshoot PHP Mail and PHPMailer Failure? How to Troubleshoot PHP Mail and PHPMailer Failure?

22 Oct 2024

This article addresses troubleshooting PHP mail() and PHPMailer functions when experiencing error messages. The main issue is email sending failure, potentially due to various causes such as class file corruption, incorrect SMTP settings, or lack of

How to Silence TensorFlow\'s Debugging Output? How to Silence TensorFlow\'s Debugging Output?

28 Oct 2024

Suppression of Tensorflow Debugging OutputTensorflow prints extensive information about loaded libraries, found devices, and other debugging data...

How Does jQuery Simplify DOM Manipulation for Web Developers? How Does jQuery Simplify DOM Manipulation for Web Developers?

03 Jan 2025

Overflow: Hidden and Expansion of HeightjQuery distinguishes itself from other JavaScript libraries through its cross-platform compatibility and...

Which native Java image processing library is right for you? Which native Java image processing library is right for you?

30 Oct 2024

Native Java Image Processing Libraries for High-Quality ResultsAs you have encountered limitations with ImageMagick and JAI, let's explore other...

See all articles