【问题标题】:How to authenticate a local xampp server to send email如何验证本地 xampp 服务器以发送电子邮件
【发布时间】:2013-08-04 00:48:11
【问题描述】:

我曾经使用 int_set 从我公司的本地 xammp 服务器发送电子邮件进行测试。

 ini_set('SMTP','mail.companysite.com');
 ini_set('smtp_port','26');
 ini_set('sendmail_from','email@companysite.com');

现在我们的主机已经升级了服务器,我们必须验证电子邮件发送。但是,我无法让 ini_set 与电子邮件身份验证一起使用。如何才能做到这一点? 我们在 windows 机器上使用 xampp。

【问题讨论】:

    标签: email authentication xampp


    【解决方案1】:

    我想通了:

    这是我的代码:

        ini_set('SMTP','mail.somewebsite');
    ini_set('smtp_port','26');
    ini_set('sendmail_from','email@somewebsite');
    ini_set('auth_username','email@somewebsite');
    ini_set('auth_password','password');
    
    $headers = "From:email@somewebsite\r\n" .
    'X-Mailer: PHP/' . phpversion() . "\r\n" .
    "MIME-Version: 1.0\r\n" .
    "Content-Type: text/html; charset=utf-8\r\n" .
    "Content-Transfer-Encoding: 8bit\r\n\r\n";
    
    
    mail("email@gmail.com", "testing authentication", "hello world", $headers);
    

    【讨论】:

      猜你喜欢
      • 2013-12-18
      • 2011-03-05
      • 2013-11-21
      • 2014-04-19
      • 2012-02-12
      • 2015-05-24
      • 2018-04-13
      • 2017-05-19
      • 2017-01-30
      相关资源
      最近更新 更多