Home > Backend Development > PHP Tutorial > Questions about sending emails with PHP

Questions about sending emails with PHP

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-06 13:53:10
Original
960 people have browsed it

<code>$mail = new PHPMailer; 
$mail->isSMTP();        
$mail->Host = 'smtp.163.com';   
$mail->SMTPAuth = true;
$mail->CharSet='UTF-8';     
$mail->Username = 'XXXX@163.com';  
$mail->Password = 'XXX';   
$mail->Port = 25;   
$mail->From = 'XXXX@163.com';            
$mail->FromName = 'XXXX';     
$mail->addAddress('XXX@qq.com');      
$mail->WordWrap = 50;                              
$mail->isHTML(true);                     
$mail->Subject = '发送邮件测试';
$mail->Body    = 'XXXX';
if(!$mail->send()) {
    echo '邮件发送失败.';
    echo '错误信息: ' . $mail->ErrorInfo;
} else {
    echo '邮件发送成功';
}
</code>
Copy after login
Copy after login

Questions about sending emails with PHP

Reply content:

<code>$mail = new PHPMailer; 
$mail->isSMTP();        
$mail->Host = 'smtp.163.com';   
$mail->SMTPAuth = true;
$mail->CharSet='UTF-8';     
$mail->Username = 'XXXX@163.com';  
$mail->Password = 'XXX';   
$mail->Port = 25;   
$mail->From = 'XXXX@163.com';            
$mail->FromName = 'XXXX';     
$mail->addAddress('XXX@qq.com');      
$mail->WordWrap = 50;                              
$mail->isHTML(true);                     
$mail->Subject = '发送邮件测试';
$mail->Body    = 'XXXX';
if(!$mail->send()) {
    echo '邮件发送失败.';
    echo '错误信息: ' . $mail->ErrorInfo;
} else {
    echo '邮件发送成功';
}
</code>
Copy after login
Copy after login

Questions about sending emails with PHP

https://github.com/kokororin/posutoba/tree/master/src/System/Library/Vendor/PHPMailer

<code>Vendor('PHPMailer.PHPMailerAutoload');
$mail = new \PHPMailer();</code>
Copy after login

Use the thinkphp framework. Just change the namespace of the SMTP class file to the same namespace as your phpmailer class. I just configured it a few days ago

Related labels:
php
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template