Home >Backend Development >PHP Tutorial >PHPMailer mail class mail sending_PHP tutorial
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. Friends in need can refer to it. At the same time Like other accessories, friends can give me your opinions.
Things to note:
1. Character set setting of the email, $mail->CharSet = "GB2312"; // Specify the character set here! Here I only specify GB2312 because this way Outlook can display the email subject normally. I have tried setting it to utf-8 but it displays garbled characters in Outlook.
2. If you are sending an email in html format, remember to also specify
3. If you want to use it to send mass emails, remember to modify the include file function, such as:
require("phpmailer/class.phpmailer.php");
Change to
require_once("phpmailer/class.phpmailer.php");
Otherwise, class redefinition will occur.
The code is as follows | Copy code |
/********************************* $mail->CharSet = "GB2312"; // Specify the character set here! Welcome to http://www.bKjia.c0m Thank you for registering as a member of this site! '; $mail->AltBody ="text/html"; if(!$mail->Send()) { echo "The email was sent in error "; |