Recently, there are always students in our php Chinese website QQ group 5 asking how to use the php mail class. Today I will give you some instructions on how to use the mail class.
This article uses the following class library as an explanation of "Powerful PHP Email Sending Class" Click on the title to go to the class library. If you need to view more php class libraries, you can click the link below: //m.sbmmt.com/xiazai/leiku
<?php /** *实例化邮件类 */ $smtpserver = "smtp.163.com"; //SMTP服务器 $smtpserverport =25; //SMTP服务器端口 $smtpusermail = "240331511@163.com"; //SMTP服务器的用户邮箱 $smtpemailto = "240331511@163.com"; //发送给谁 $smtpuser = "240331511@163.com"; //SMTP服务器的用户帐号 $smtppass = "123147mcl"; //SMTP服务器的用户密码 $mailsubject = "PHP100测试邮件系统"; //邮件主题 $mailbody = "<h1>你的用户名是张三,密码是123147mcl </h1>"; //邮件内容 $mailtype = "HTML"; //邮件格式(HTML/TXT),TXT为文本邮件 $smtp = new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppass); $smtp->debug = true; //是否显示发送的调试信息 $smtp->sendmail($smtpemailto, $smtpusermail, $mailsubject, $mailbody, $mailtype); ?>
Directly instantiate this email class and configure it according to the comment content to achieve mass sending of emails.
Note: Since we are using a third-party mail system (such as QQ mailbox), we need to configure the mailbox to a certain extent. The details are as follows:
What are the POP3 and SMTP servers of QQ mailbox?
QQ mailbox POP3 and SMTP server address settings are as follows:
Mailbox | POP3 server ( Port 995) | SMTP server (port 465 or 587) |
---|---|---|
qq.com | pop.qq.com | smtp .qq.com |
SMTP server requires authentication.
security of your account, changing the QQ password and independent password will trigger the authorization code to expire, and you need to obtain a new authorization code to log in.
2. How to obtain the authorization code? First go to Settings -> Account page to find the entrance, and follow the following process. (1) Click "Open"## Modify as shown above Once done.
php implements a class for sending emailsSocket in php sends email verification email classphp sends email classPHP email STMP simple classMail sending php classphp-socket sending mail classphp-Mailer mail classComplete email sending class for php