调用示例
$port = 25; $user = 'username'; //请替换成你自己的smtp用户名 $pass = 'pass'; //请替换成你自己的smtp密码 $host = 'smtp.163.com'; $from = 'xxxxx@163.com'; $to = 'xxxx@qq.com'; $body = 'hello world'; $subjet = '我是标题'; $mailer = new Mailer($host,$port,$user,$pass,true); $mailer->sendMail($from,$to,$subjet,$body);
在执行指令时有输出调试信息,输出了我们每次执行的指令以及smtp服务返回给我们的响应数据。
因此我们可以看到以下结果
Debug:220 163.com Anti-spam GT for Coremail System (163com[20141201]) Debug:cmd:HELO smtp.163.com ;response:250 OK Debug:cmd:AUTH LOGIN ;response:334 dXNlcm5hbWU6 Debug:cmd:aXR6aG91anVuYmxvZ0AxNjMuY29t ;response:334 UGFzc3dvcmQ6 Debug:cmd:QzBjSGRRNe32xiNGFYUE5oag== ;response:235 Authentication successful Debug:cmd:MAIL FROM: ;response:250 Mail OK Debug:cmd:RCPT TO:<380472723@qq.com> ;response:250 Mail OK Debug:cmd:DATA ;response:354 End data with . Debug:cmd:From:itzhoujunblog@163.com To:380472723@qq.com Subject:我是标题 Content-Type: Text/html; charset=gb2312 hello world . ;response:250 Mail OK queued as smtp11,D8CowACXHE5APdNYCo0hAQ--.19144S2 1490238785 Debug:cmd:QUIT ;response:221 Bye
总结
邮件发送步骤
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。