目次
PHPMailer邮件发送,phpmailer接收邮件
ホームページ php教程 php手册 PHPMailer邮件发送,phpmailer接收邮件

PHPMailer邮件发送,phpmailer接收邮件

Jun 13, 2016 am 08:57 AM
phpmailer 送信 引用 引き継ぐ 郵便

PHPMailer邮件发送,phpmailer接收邮件

引用文件PHPMailerAutoload.php、class.phpmailer.php、class.smtp.php

实例化应用文件index.php


//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');

require './PHPMailerAutoload.php';

//Create a new PHPMailer instance
$mail = new PHPMailer();
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "smtp.qq.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "###@qq.com";//发送人Email及姓名
//Password to use for SMTP authentication
$mail->Password = "####";;//发送人密码及姓名
//Set who the message is to be sent from
$mail->setFrom('####@qq.com', 'First Last');//发送人Email及姓名
//Set an alternative reply-to address
$mail->addReplyTo('###@qq.com', 'First Last');//发送人Email及姓名
//Set who the message is to be sent to
$mail->addAddress('###@qq.com', 'John Doe');//收件人Email及姓名
//Set the subject line
$mail->Subject = 'PHPMailer SMTP test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML("adwawdawd");
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
//$mail->addAttachment('images/phpmailer_mini.png');

//send the message, check for errors
if (!$mail->send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
?>

发送人的使用qq邮件需要在qq邮箱里面配置qq邮箱的邮件服务器

このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。

ホットな記事タグ

メモ帳++7.3.1

メモ帳++7.3.1

使いやすく無料のコードエディター

SublimeText3 中国語版

SublimeText3 中国語版

中国語版、とても使いやすい

ゼンドスタジオ 13.0.1

ゼンドスタジオ 13.0.1

強力な PHP 統合開発環境

ドリームウィーバー CS6

ドリームウィーバー CS6

ビジュアル Web 開発ツール

SublimeText3 Mac版

SublimeText3 Mac版

神レベルのコード編集ソフト(SublimeText3)

Windows 11のコントロールパネルからOutlookメールが失われる Windows 11のコントロールパネルからOutlookメールが失われる Feb 29, 2024 pm 03:16 PM

Windows 11のコントロールパネルからOutlookメールが失われる

PHP は電子メールを非同期に送信します。電子メールの送信を長時間待つ必要がなくなります。 PHP は電子メールを非同期に送信します。電子メールの送信を長時間待つ必要がなくなります。 Sep 19, 2023 am 09:10 AM

PHP は電子メールを非同期に送信します。電子メールの送信を長時間待つ必要がなくなります。

Apple Notes でブロック引用符を使用する方法 Apple Notes でブロック引用符を使用する方法 Oct 12, 2023 pm 11:49 PM

Apple Notes でブロック引用符を使用する方法

Word の差し込み印刷で空白ページが印刷される Word の差し込み印刷で空白ページが印刷される Feb 19, 2024 pm 04:51 PM

Word の差し込み印刷で空白ページが印刷される

WhatsApp のヒント: HD 写真とビデオを送信する方法 WhatsApp のヒント: HD 写真とビデオを送信する方法 Sep 10, 2023 am 10:13 AM

WhatsApp のヒント: HD 写真とビデオを送信する方法

TikTokで他の人にファイルを送信するにはどうすればよいですか?他の人に送信したファイルを削除するにはどうすればよいですか? TikTokで他の人にファイルを送信するにはどうすればよいですか?他の人に送信したファイルを削除するにはどうすればよいですか? Mar 22, 2024 am 08:30 AM

TikTokで他の人にファイルを送信するにはどうすればよいですか?他の人に送信したファイルを削除するにはどうすればよいですか?

PHP 開発の実践: PHPMailer を使用して MySQL データベース内のユーザーに電子メールを送信する PHP 開発の実践: PHPMailer を使用して MySQL データベース内のユーザーに電子メールを送信する Aug 05, 2023 pm 06:21 PM

PHP 開発の実践: PHPMailer を使用して MySQL データベース内のユーザーに電子メールを送信する

C++ コンパイル エラー: 未定義の参照、解決方法は? C++ コンパイル エラー: 未定義の参照、解決方法は? Aug 21, 2023 pm 08:52 PM

C++ コンパイル エラー: 未定義の参照、解決方法は?

See all articles