解决MANTIS无法发送邮件的问题

Posted on Posted in 经验分享

Mantis安装好之后,注册用户的时候,发送用户邮件不太好使。通过查看Mantis源码,调试mantis邮件配置后解决了这个的问题。

1,测试发送邮件
需要修改的文件:config_defaults_inc.php。下面以腾讯企业邮箱为例

?

77

$g_administrator_email    =’mantis@pooy.net’;

$g_webmaster_email         =’mantis@pooy.net’;

$g_from_email              =’mantis@pooy.net’;

$g_return_path_email    =’mantis@pooy.net’;

$g_enable_email_notification    = ON;

$g_phpMailer_method       = PHPMAILER_METHOD_SMTP;

$g_smtp_host              =’smtp.exmail.qq.com’;

$g_smtp_username=’mantis@pooy.net’;

$g_smtp_password=’JD8WJ9KD’;

$g_smtp_port= 465;

配置文件修改完毕之后,接着开始测试:mantis里面自带有测试文件,目录在:library/phpmailer/email.php
我的测试脚本如下:

77

<?php

/**

* @author [pooy] <[pooy@pooy.net]>

* @blog  http://www.pooy.net

*/

require’class.phpmailer.php’;

$mail=newPHPMailer;

$mail->SMTPDebug = 1;

$mail->IsSMTP();                                     // Set mailer to use SMTP

$mail->Host =’smtp.exmail.qq.com’; // Specify main and backup server

$mail->SMTPAuth = true;                              // Enable SMTP authentication

$mail->Username =’mantis@pooy.net’;                           // SMTP username

$mail->Port = 465;

$mail->Password =’JD8WJ9KD’;                          // SMTP password

$mail->SMTPSecure =’ssl’;                           // Enable encryption, ‘ssl’ also accepted

$mail->From =’mantis@pooy.net’;

$mail->FromName =’Mailer Testing’;

$mail->WordWrap = 50;                                // Set word wrap to 50 characters

$mail->IsHTML(true);                                 // Set email format to HTML

$mail->Subject =’Here is the subject’;

$mail->Body    =’This is the HTML message body <b>in bold!</b>’;

$mail->AltBody =’This is the body in plain text for non-HTML mail clients’;

if(!$mail->Send()) {

   echo’Message could not be sent.’;

   echo’Mailer Error: ‘.$mail->ErrorInfo;

   exit;

}

echo’Message has been sent’;

// To load the French version

$mail->SetLanguage(‘cn’,’/optional/path/to/language/directory/’);

?>

你可以使用浏览器访问这个脚本,或者直接在shell或者dos下运行这个。
因为上面我开了debug,所以会得到下面的返回结果:

?

001

002

003

004

005

006

007

008

009

010

011

012

013

014

015

016

017

018

019

020

021

022

023

024

025

026

027

028

029

030

031

032

033

034

035

036

037

038

039

040

CLIENT -> SMTP: EHLO 115.28.15.50

CLIENT -> SMTP: AUTH LOGIN

CLIENT -> SMTP: bWFudGlzQHdlaXRvdWh1aXJvbmcuY29t

CLIENT -> SMTP: SkQ4V0o5S0Q=

CLIENT -> SMTP: MAIL FROM:

CLIENT -> SMTP: RCPT TO:

CLIENT -> SMTP: DATA

CLIENT -> SMTP: Date: Wed, 7 May 2014 16:34:36 +0800

CLIENT -> SMTP: Return-Path:

$(function(){ $(window).resize(function(){ $(“#main-container”).css(“min-height”, $(window).height() – 343); }).resize(); })