欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

感觉有点诡异,无法送邮件,似乎smtp和phpmailer有冲突

shiping1 的头像

问题描述:如果在phpmailer设置中勾选“use phpmailer to send emails",则我用smtp发送测试邮件时会显示邮件发送失败;如果不勾选那个选项,则可以正常发出smtp测试邮件,并可顺利收到。

在phpmailer设置时发送phpmailer测试邮件,这个是正常的。

具体描述:我先设置的phpmailer,勾选上“use phpmailer to send emails"并进行其他设置,后设置smtp,然后再用smtp进行发送测试,结果是这样的:在显示测试邮件发送的同时,底下又以红色显示无法发送。

查看日志说是”SMTP error: could not connect to SMTP host“

然后我做了一个尝试,把phpmailer设置时,不勾选“use phpmailer to send emails",虽然phpmailer会提示说PHPMailer is currently disabled.,但是此时用smtp测试发邮件,则会显示测试邮件已发送,同时没有错误信息,查了下接收测试邮件的邮箱,顺利收到测试邮件。

 

问题是,我不可能在phpmailer设置时不勾选“use phpmailer to send emails"啊,可是一旦我勾选了就会could not connect to SMTP host,问题出在哪里呢?

 

我之前的安装和设置操作:

安装环节:安装smtp,然后把phpmailer整个文件夹直接考到虚拟主机的drupal/sites/all/modules/smtp下,之后启用这两个模块,但是phpmailer显示有问题,然后根据drupal提示,从http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/下载了PHPMailer v5.1,解压缩后把class.phpmailer.php, class.smtp.php两个文件放在了drupal/sites/all/libraries下(这个libraries文件夹是我新建的,phpmailer的read me文档建议把那两个文件放在这个目录下)

然后就是设置了:

先设置PHPMAILER:

勾选Use PHPMailer to send e-mails

Primary SMTP server ——smtp.exmail.qq.com(腾讯的域名邮箱)

Backup SMTP server——同上

SMTP port——25(查过了腾讯域名邮箱是25)

Use secure protocol——否

SMTP AUTHENTICATION项

username ----> 按照youremail@yourdomain.com格式写的,但是我的域名后缀是.li,保证跟站点信息里的email地址相同

Change password——留空或者填成上面这个邮箱的登录密码,两种我都试了

ADVANCED SMTP SETTINGS项

from name——我随便填的

然后SMTP设置:

Turn this module on or off —— on

smtp server ----> smtp.exmail.qq.com

smtp backup server ----> smtp.exmail.qq.com

smtp port ----> 25

use encrypted protocol ----> no
 

SMTP AUTHENTICATION项

username ----> 按照youremail@yourdomain.com格式写的,但是我的域名后缀是.li
Change password——留空或者填成上面这个邮箱的登录密码,两种我都试了

E-mail from address ----> 按照youremail@yourdomain.com填写,保证跟站点信息里的email地址相同
 

E-mail from name ----> 随便填了一个

 

另外查了下我用的是Godaddy的虚拟主机支持fsockopen函数,那就不用改这个了

 

希望大侠指点,哪位同仁遇到过相同的问题如有解决办法也望不吝赐教,不胜感谢

 

 

3 个回答

赞成!
0
否决!

我想你误解了

我之前的安装和设置操作:
安装环节:安装smtp,然后把phpmailer整个文件夹直接考到虚拟主机的drupal/sites/all/modules/smtp下,之后启用这两个模块,但是phpmailer显示有问题,然后根据drupal提示,从http://sourceforge.net/projects/phpmailer/files/phpmailer%20for%20php5_6/下载了PHPMailer v5.1,解压缩后把class.phpmailer.php, class.smtp.php两个文件放在了drupal/sites/all/libraries下(这个libraries文件夹是我新建的,phpmailer的read me文档建议把那两个文件放在这个目录下)

 

首先 phpmailer 在drupal里面也有两个概念:

第一个概念是 phpmailer 模块,它是一个模块。

第二个概念是 phpmailer library,它是一个第三方用于发送电子邮件的PHP函数包。

 

smtp 模块 的安装步骤是:

1,拷贝smtp模块到sites/all/modules/

2,登陆管理员在模块管理页开启smtp

3,拷贝 phpmailer library(非 phpmailer 模块)到 sites/all/modules/smtp/phpmailer 下方

smtp模块是独立运行,不需要安装 phpmailer 模块,只需要 phpmailer library。

 
赞成!
0
否决!

请问只要进行这些操作就可以了么,我看到read me 文档里关于安装有这么一段话,我是否还需要操作这些?谢谢

 

Installation:

Copy class.phpmailer.php into your php.ini include_path. If you are
using the SMTP mailer then place class.smtp.php in your path as well.
In the language directory you will find several files like
phpmailer.lang-en.php.  If you look right before the .php extension
that there are two letters.  These represent the language type of the
translation file.  For instance "en" is the English file and "br" is
the Portuguese file.  Chose the file that best fits with your language
and place it in the PHP include path.  If your language is English
then you have nothing more to do.  If it is a different language then
you must point PHPMailer to the correct translation.  To do this, call
the PHPMailer SetLanguage method like so:

// To load the Portuguese version
$mail->SetLanguage("br", "/optional/path/to/language/directory/");

That's it.  You should now be ready to use PHPMailer!

 
赞成!
0
否决!

谢谢诗人指点,我刚才照着操作了,先从http://code.google.com/a/apache-extras.org/p/phpmailer/downloads/list下载了“PHPMailer_5.2.1.zip”,这个应该就是phpmailer  library吧

然后我把其中的文件复制到了sites/all/modules/smtp/phpmailer 下

就这些操作,用smtp发测试邮件,往qq邮箱发显示成功,也无提示错误信息,但事实收不到,往gmail或者yahoo发均可以收到

尝试注册用户,提交用户名和邮箱后,提示邮件发送失败


来自 http://www.drupalla.com/node/1302

普通分类: