<?php require './PHPMailer-master/PHPMailerAutoload.php'; $mail = new PHPMailer; //$mail->SMTPDebug = 3; // 關(guān)閉SMTP調(diào)試功能 1 = error // Enable verbose debug output $mail->isSMTP(); // 使用SMTP服務(wù) // Set mailer to use SMTP $mail->Host = 'smtp.163.com'; // 發(fā)送方的SMTP服務(wù)器地址 // Specify main and backup SMTP servers $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'xxxxxxx@163.com'; // 發(fā)送方的163郵箱用戶名 // SMTP username $mail->Password = 'xxxxx'; // 發(fā)送方的郵箱密碼,注意用163郵箱這里填寫的是“客戶端授權(quán)密碼”而不是郵箱的登錄密碼! // SMTP password $mail->SMTPSecure = 'ssl'; // 使用ssl協(xié)議方式 // Enable TLS encryption, `ssl` also accepted $mail->Port = 994; // 163郵箱的ssl協(xié)議方式端口號是465/994 // TCP port to connect to $mail->CharSet = "utf8"; // 編碼格式為utf8,不設(shè)置編碼的話,中文會出現(xiàn)亂碼 $mail->SMTPAuth = true; // 是否使用身份驗證 $mail->setFrom('xxxxxxx@163.com', 'myafa'); // 設(shè)置發(fā)件人信息,如郵件格式說明中的發(fā)件人,這里會顯示為Mailer(xxxx@163.com),Mailer是當(dāng)做名字顯示 $mail->addAddress('11111@aliyun.com', '老鐵'); // 設(shè)置收件人信息// Add a recipient $mail->addAddress('22222@qq.com', '老鐵'); // 設(shè)置收件人信息, $mail->addAddress('xxxxxxx@163.com', '老鐵'); // 設(shè)置收件人信息, //$mail->addAddress('ellen@example.com'); // Name is optional //$mail->addReplyTo('info@example.com', 'Information'); // 設(shè)置回復(fù)人信息,指的是收件人收到郵件后,如果要回復(fù),回復(fù)郵件將發(fā)送到的郵箱地址 //$mail->addCC('cc@example.com'); // 設(shè)置郵件抄送人,可以只寫地址,上述的設(shè)置也可以只寫地址 //$mail->addBCC('bcc@example.com'); // 設(shè)置秘密抄送人 //$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

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

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

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

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

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

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


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
