This error occurs when sending a message using PHP: The following from address failed:xxxx@163.com

Source: Internet
Author: User
Use the TP frame! The following is the source code:
namespace Apicontroller;

Use Thinkcontroller;

Class Emailcontroller extends Controller
{
Public Function test () {

  $msg = pmail('493107977@qq.com','午夜DJ','封装测试','hello world');  echo $msg;

}

?php>

Return Array (

//'配置项'=>'配置值''TMPL_PARSE_STRING' => array(    '__ADMIN__' => '/Public/Admin',    '__COMMON__' => '/Public/Common',    '__VENDORS__' => '/Public/Venders',    '__HOME__' => '/Public/Home',    '__USER__' => '/Public/User',    '__UP_GOODS__'=>'/Public/Uploads/Goods',    '__UP_USER__'=>'/Public/Uploads/User'),'PMAIL' => array(    'Host' => 'stmp.163.com',    'Username' => 'xxxxxx',    'Password' => 'xxxxxx',    'From' => 'xxxxx@163.com',    'FromName' => 'xxxx',),

);

function Pmail ($tomail = ", $toname =", $title = ", $content =") {

require_once VENDOR_PATH.'PHPMailer/class.phpmailer.php';// 实例化$pm = new \PHPMailer();foreach (C('PMAIL') as $k => $v){    $pm->$k = $v;}

Server-related information
$pm->host = ' smtp.163.com '; SMTP server

$pm->IsSMTP(); // 设置使用SMTP服务器发送邮件$pm->SMTPAuth = true; // 需要SMTP身份认证

$pm->username = ' woainigui8888 '; User name to log on to the SMTP server
$pm->password = ' 7618387asd '; Password to log on to the SMTP server
//
Sender Information
$pm->from = ' woainigui8888@163.com ';
$PM->fromname = ' The King of electrical tones ';

Recipient information

$pm->AddAddress($tomail,$toname); // 添加一个收件人

Message content

$pm->CharSet = 'utf-8'; // 内容编码$pm->Subject = $title; // 邮件标题$pm->MsgHTML($content); // 邮件内容

$this->addattachment ($path); Attachment

Send mail

if($pm->Send()){    return true;}else {    return $pm->ErrorInfo;}

}

This error occurs when sending a message using PHP: The following from address failed:xxxx@163.com

Reply content:

Use the TP frame! The following is the source code:
namespace Apicontroller;

Use Thinkcontroller;

Class Emailcontroller extends Controller
{
Public Function test () {

  $msg = pmail('493107977@qq.com','午夜DJ','封装测试','hello world');  echo $msg;

}

?php>

Return Array (

//'配置项'=>'配置值''TMPL_PARSE_STRING' => array(    '__ADMIN__' => '/Public/Admin',    '__COMMON__' => '/Public/Common',    '__VENDORS__' => '/Public/Venders',    '__HOME__' => '/Public/Home',    '__USER__' => '/Public/User',    '__UP_GOODS__'=>'/Public/Uploads/Goods',    '__UP_USER__'=>'/Public/Uploads/User'),'PMAIL' => array(    'Host' => 'stmp.163.com',    'Username' => 'xxxxxx',    'Password' => 'xxxxxx',    'From' => 'xxxxx@163.com',    'FromName' => 'xxxx',),

);

function Pmail ($tomail = ", $toname =", $title = ", $content =") {

require_once VENDOR_PATH.'PHPMailer/class.phpmailer.php';// 实例化$pm = new \PHPMailer();foreach (C('PMAIL') as $k => $v){    $pm->$k = $v;}

Server-related information
$pm->host = ' smtp.163.com '; SMTP server

$pm->IsSMTP(); // 设置使用SMTP服务器发送邮件$pm->SMTPAuth = true; // 需要SMTP身份认证

$pm->username = ' woainigui8888 '; User name to log on to the SMTP server
$pm->password = ' 7618387asd '; Password to log on to the SMTP server
//
Sender Information
$pm->from = ' woainigui8888@163.com ';
$PM->fromname = ' The King of electrical tones ';

Recipient information

$pm->AddAddress($tomail,$toname); // 添加一个收件人

Message content

$pm->CharSet = 'utf-8'; // 内容编码$pm->Subject = $title; // 邮件标题$pm->MsgHTML($content); // 邮件内容

$this->addattachment ($path); Attachment

Send mail

if($pm->Send()){    return true;}else {    return $pm->ErrorInfo;}

}

This error occurs when sending a message using PHP: The following from address failed:xxxx@163.com

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.