Example
require_once ('PHPMailer/class.phpmailer.php'); //Introduce phpmailer file
require_once ('PHPMailer/class.smtp.php');
$mail=new PHPMailer(); //Instantiate the phpmailer class
$mail->IsSMTP();
$mail->CharSet='UTF-8';
$mail->AddAddress(123@163.com); //Recipient’s email address
$mail->Body=$content; //Sending content
$mail->From=from@163.com; //Sender’s email from@163.com
$mail->FromName="zjsupport"; //Sender's name
$mail->Subject="title"; //Email title
$mail->Host="smtp.163.com"; //smtp server
$mail->SMTPAuth=true; //Enable smtp service
$mail->IsHTML(true);
//Send attachment
$mail->AddAttachment(path,name); //path is the save path of the attachment name is the name of the attachment
// You can upload multiple attachments, and copy the same copy of the $ Mail-& GT; addattachment (path, name);
$mail->Username="from@163.com ";//Sender's email address
$mail->Password="123456";//Sender's email password
if($mail->Send()){ //Determine whether the email is sent successfully
echo "success";
}else{
$email_error=$email_error.";".$val; //If unsuccessful, store the failed email address in the character string
}
if($email_error==""){
echo "email_success";
}else{
echo $email_error;
}
http://www.bkjia.com/PHPjc/477115.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477115.htmlTechArticleExample require_once (PHPMailer/class.phpmailer.php); //Introduce phpmailer file require_once (PHPMailer/class.smtp .php); $mail=new PHPMailer(); //Instantiate the phpmailer class $mail-IsSMTP();...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn