PHPMailer Send Email_PHP Tutorial
刚刚出炉的自己博客文章来与大家共享下^_^,下面文章转载自我的博客:久酷博客
上篇文章PHP mail()方法发送邮件部分邮箱无法收到邮件问题 提到要介绍一下phpmailer这款免费开源的php 邮件程序,下面我们来看看吧,以下资料全部来自phpmailer官方网站:
PHPMailer 也是一个功能强大的邮件类
PHPMailer的主要功能特点:
支持邮件 s/mime加密的数字签名
支持邮件多个 TOs, CCs, BCCs and REPLY-TOs
可以工作在任何服务器平台,所以不用担心WIN平台无法发送邮件的问题的
支持文本/HTML格式邮件
可以嵌入image图像
对于邮件客户端不支持HTML阅读的进行支持
功能强大的发送邮件调试功能debug
自定义邮件header
冗余SMTP服务器支持
支持8bit, base64, binary, and quoted-printable 编码
文字自动换行
支持多附件发送功能
支持SMTP服务器验证功能
在Sendmail , qmail , Postfix , Gmail , Imail, Exchange 等平台测试成功
提供的下载文件中,包括内容详细的说明文档及示例说明,所以不用担心难于上手的问题!
PHPMailer 非常小巧、简单、方便、快捷
以上资料由Jiucool 翻译自phpmailer 官网,转载请注明!
Usage of PHPMailer (here is using gmail smtp to send emails as an example. Of course, sendmail pop and other methods are also supported):
First go to http://phpmailer.worxware.com/ to download the latest version of the package
After the download is completed, find the two classes class.phpmailer.php and class.smtp.php and put them in your own directory!
Then create a new php file and name it here: phpmail_jiucool.php
phpmail_jiucool.php The content is as follows:
I directly write the email sending module as a function postmail_jiucool_com(). You can call this function directly when using it. , the function content is:
function postmail_jiucool_com($to,$subject = "",$body = ""){
//Author:Jiucool WebSite: http://www.jiucool.com
/ /$to represents the recipient address $subject represents the email title $body represents the email body
//error_reporting(E_ALL);
error_reporting(E_STRICT);
date_default_timezone_set("Asia/Shanghai");// Set time zone Dongba District
require_once(class.phpmailer.php);
include("class.smtp.php");
$mail = new PHPMailer(); //new a PHPMailer object comes out
$body = eregi_replace("[]",,$body); //Perform necessary filtering on the email content
$mail->CharSet = "UTF-8";//Set the email encoding, The default is ISO-8859-1. If you send Chinese, this must be set, otherwise it will be garbled.
$mail->IsSMTP(); // Set to use SMTP service.
$mail->SMTPDebug = 1; Enable SMTP debugging
// 1 = errors and messages
// 2 = messages only
$mail->SMTPAuth = true; // Enable SMTP authentication function
$mail->SMTPSecure = "ssl"; // SMTP server port number
$mail->Username = "SMTP server username"; // SMTP server username
$mail->Password = "SMTP server password"; // SMTP server password
$mail- >SetFrom(Sender address, such as admin#jiucool.com #Replace with @, sender name);
$mail->AddReplyTo("Email reply address, such as admin#jiucool.com #Replace with @","Name of the person who responded to the email");
$mail->Subject = $subject;
$mail->AltBody = "To view the message, please use an HTML compatible email viewer! - From www.jiucool.com"; // optional, comment out and test
$mail->MsgHTML($body);
$address = $to;
$mail->AddAddress($ address, "recipient name");
//$mail->AddAttachment("images/phpmailer.gif"); // attachment
//$mail->AddAttachment("images/phpmailer_mini .gif"); // attachment
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent! Congratulations, the email was sent successfully!";
www.bkjia.com

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Is the Outlook mail icon missing from Windows 11's Control Panel? This unexpected situation has caused confusion and concern among some individuals who rely on OutlookMail for their communication needs. Why don't my Outlook emails show up in Control Panel? There may be several possible reasons why there are no Outlook mail icons in Control Panel: Outlook is not installed correctly. Installing Office applications from the Microsoft Store does not add the Mail applet to Control Panel. The location of the mlcfg32.cpl file in Control Panel is missing. The path to the mlcfg32.cpl file in the registry is incorrect. The operating system is not currently configured to run this application

More and more enterprises choose to use exclusive enterprise WeChat, which not only facilitates communication between enterprises and customers and partners, but also greatly improves work efficiency. Enterprise WeChat has rich functions, among which the screen sharing function is very popular. During the meeting, by sharing the screen, participants can display content more intuitively and collaborate more efficiently. So how to share your screen efficiently in WeChat Enterprise? For users who don’t know yet, this tutorial guide will give you a detailed introduction. I hope it can help you! How to share screen on WeChat Enterprise? 1. In the blue area on the left side of the main interface of Enterprise WeChat, you can see a list of functions. We find the "Conference" icon. After clicking to enter, three conference modes will appear.

How to set up keyboard startup on Gigabyte's motherboard. First, if it needs to support keyboard startup, it must be a PS2 keyboard! ! The setting steps are as follows: Step 1: Press Del or F2 to enter the BIOS after booting, and go to the Advanced (Advanced) mode of the BIOS. Ordinary motherboards enter the EZ (Easy) mode of the motherboard by default. You need to press F7 to switch to the Advanced mode. ROG series motherboards enter the BIOS by default. Advanced mode (we use Simplified Chinese to demonstrate) Step 2: Select to - [Advanced] - [Advanced Power Management (APM)] Step 3: Find the option [Wake up by PS2 keyboard] Step 4: This option The default is Disabled. After pulling down, you can see three different setting options, namely press [space bar] to turn on the computer, press group

Users can share the wallpapers they obtain with friends when using WallpaperEngine. Many users do not know how to share WallpaperEngine with friends. They can save their favorite wallpapers locally and then share them with friends through social software. How to share wallpaperengine with friends Answer: Save it locally and share it with friends. 1. It is recommended that you save your favorite wallpapers locally and then share them with friends through social software. 2. You can also upload it to the computer through a folder, and then click Share using the creative workshop function on the computer. 3. Use Wallpaperengine on the computer, open the options bar of the creative workshop and find

Quick Share can save Samsung users a lot of time transferring files between devices. But Samsung Galaxy users have complained about facing issues with the Quick Share feature on their phones. Typically, visibility issues in quick sharing cause this issue. So, this is the only guide you need to troubleshoot the Quick Share feature on your Galaxy device. Fix 1 – Change Quick Share Visibility Settings Toggle the Quick Share visibility setting on your phone. Quick Share might be set to the wrong settings, causing this issue. Step 1 – First, swipe up once to open the app drawer. Step 2 – Once there, open Settings. Step 3 – Go to the Settings page and open the Connected Devices tab. Step 4 – Turn on the “Quick Share” feature. Step 5

1. How can you make money by publishing articles on Toutiao today? How to earn more income by publishing articles on Toutiao today! 1. Activate basic rights and interests: original articles can earn profits by advertising, and videos must be original in horizontal screen mode to earn profits. 2. Activate the rights of 100 fans: if the number of fans reaches 100 fans or above, you can get profits from micro headlines, original Q&A creation and Q&A. 3. Insist on original works: Original works include articles, micro headlines, questions, etc., and are required to be more than 300 words. Please note that if illegally plagiarized works are published as original works, credit points will be deducted, and even any profits will be deducted. 4. Verticality: When writing articles in professional fields, you cannot write articles across fields at will. You will not get appropriate recommendations, you will not be able to achieve the professionalism and refinement of your work, and it will be difficult to attract fans and readers. 5. Activity: high activity,

1. Processor When choosing a computer configuration, the processor is one of the most important components. For playing games like CS, the performance of the processor directly affects the smoothness and response speed of the game. It is recommended to choose Intel Core i5 or i7 series processors because they have powerful multi-core processing capabilities and high frequencies, and can easily cope with the high requirements of CS. 2. Graphics card Graphics card is one of the important factors in game performance. For shooting games such as CS, the performance of the graphics card directly affects the clarity and smoothness of the game screen. It is recommended to choose NVIDIA GeForce GTX series or AMD Radeon RX series graphics cards. They have excellent graphics processing capabilities and high frame rate output, and can provide a better gaming experience. 3. Memory power

If you find that blank pages appear when printing a mail merge document using Word, this article will help you. Mail merge is a convenient feature that allows you to easily create personalized documents and send them to multiple recipients. In Microsoft Word, the mail merge feature is highly regarded because it helps users save time manually copying the same content for each recipient. In order to print the mail merge document, you can go to the Mailings tab. But some Word users have reported that when trying to print a mail merge document, the printer prints a blank page or doesn't print at all. This may be due to incorrect formatting or printer settings. Try checking the document and printer settings and make sure to preview the document before printing to ensure the content is correct. if
