PHPMailer 不工作 properly.it 显示 bool(false)


PHPMailer is not working properly.it shows bool(false)

我想用PHPMailer发送邮件。

我已经从github下载了phpmailer类,并将PHPMailerAutoload.php文件包含在我的index.php文件中。

<?php
require_once('libs/PHPMailer/PHPMailerAutoload.php');
$m = new PHPMailer;
$m->isSMTP();
$m->SMTPAuth = true;
$m->SMTPDebug = 2;
$m->Host = 'smtp.gmail.com';
$m->username = 'manish@example.com';
$m->password = 'example_!@#4';
$m->SMTPSecure = 'ssl';
$m->Port = 465;
$m->From='manish@example.com';
$m->FromName='Manish';
$m->addReplyTo('manish@example.com','Reply Address');
$m->addAddress('manish@example.com','Manish Address');
$m->Subject = 'Here is an Email';
$m->body = 'This is body';
$m->AltBody = 'This is the body osf email';
var_dump($m->send());

更改以下行

$m->IsSmtp();

$m->IsMail();
or 
$m->IsSendmail();

包括我更多的文件,我编辑了你的代码请检查

require_once('libs/PHPMailer/PHPMailerAutoload.php');
require 'libs/PHPMailer/class.phpmailer.php';
$m = new PHPMailer;
$m->isSMTP();
$m->SMTPAuth = true;
$m->Host = 'smtp.gmail.com';
$m->Username = 'manish@example.com';
$m->Password = 'example_!@#4';
$m->SMTPSecure = 'ssl';
$m->Port = 465;
$m->setFrom('manish@example.com', 'Manish');
$m->AddReplyTo('manish@example.com','Reply Address');
$m->AddAddress('manish@example.com','Manish Address');
$m->Subject = 'Here is an Email';
$m->Body = 'This is body';
$m->AltBody = 'This is the body osf email';
var_dump($m->send());