窗户的Apache2.2 PHP5 PHPMailer的错误 [英] Windows Apache2.2 PHP5 PHPMailer Error

查看:152
本文介绍了窗户的Apache2.2 PHP5 PHPMailer的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在阅读一些老问题,我还没有找到没有解决我的问题。
在这里,它去。

I have been reading some older questions and I haven't found yet the solution to my problem. Here it goes.

我正在开发一个很酷的网站,一些邮件的功能,限制了管理员用户。
现在我正在开发localhost上的网站,但我一直在提供与将用于网站的Gmail帐户。

I'm developing a cool website with some mail functions, limited for admin users. Right now I'm developing the site on localhost, but I've been provided with a Gmail account that will be used for the website.

我一直在寻找通过网络和PHPMailer的模块似乎是一个不错的选举。

I've been seeking through the web and the PHPMailer module seems a good election.

我的想法是从我的本地发送电子邮件使用Gmail帐户的其他电子邮件地址。

My idea is to send emails from my localhost to any other email address using the Gmail account.

下面是我使用的codeS。
对于服务器的Apache2.2

Here are the codes I'm using. For the Apache2.2 server

LoadModule ssl_module modules/mod_ssl.so

有关的php.ini

For php.ini

[mail function]
SMTP = smtp.gmail.com
smtp_port = 465
sendmail_from = admins.domaing@gmail.com

和PHP的codeS

And the php codes

<?php
  date_default_timezone_set("Europe/Madrid");   
  require_once("class.phpmailer.php"); 
  $mail = new PHPMailer();
  $body             = 'It works!';
  $mail->IsSMTP();
  $mail->Host       = "smtp.gmail.com";
  $mail->SMTPDebug  = 2; 
  $mail->SMTPAuth   = true;
  $mail->SMTPSecure = "ssl";
  $mail->Host       = "smtp.gmail.com";
  $mail->Port       = 465; 
  $mail->Username   = "admins.domaing@gmail.com";
  $mail->Password   = "*********";
  $mail->SetFrom('admins.domaing@gmail.com', 'Admin');
  $mail->Subject    = "PHPMailer Test Subject via smtp (Gmail), basic"; 
  $mail->MsgHTML($body);
  $address = "user@email.com";
  $mail->AddAddress($address, "user name");
  if(!$mail->Send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
  } else {
    echo "Message sent!";
  }
?>

其实我得到的错误是:

Actually the error I'm getting is:

Invalid XML: SMTP -> ERROR: Failed to connect to server: (0)

有什么建议?

推荐答案

从原来的海报解决方法:

Solution from the original poster:

只要修改

$ MAIL-GT&;用户名=admins.domaing@gmail.com;

$ MAIL-GT&;用户名=admins.domaing;

这篇关于窗户的Apache2.2 PHP5 PHPMailer的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆