配置SourceForge SMTP服务器

WBOY
Release: 2016-06-23 13:49:00
Original
1381 people have browsed it

这是SOURCEFORGE.NET提供的样本代码,用户在includes/mail.inc(其内容见附件)找到与它衔接的函数作必要的修改后即可在自己的project web site是应用SF的prwebmail服务器发送邮件,例如新注册用户的激活信件。它用来取代php.ini的SMTP缺省设置,要知道虚拟主机用户是没有权限编辑php.ini的。

include('Mail.php');

$recipients = array( 'someone@example.com' ); # Can be one or more emails

$headers = array (
'From' => 'someone@example.com',
'To' => join(', ', $recipients),
'Subject' => 'Testing email from project web',
);

$body = "This was sent via php from project web!\n";

$mail_object =& Mail::factory('smtp',
array(
'host' => 'prwebmail',
'auth' => true,
'username' => 'YOUR_PROJECT_NAME',
'password' => 'PASSWORD', # As set on your project's config page
#'debug' => true, # uncomment to enable debugging
));

$mail_object->send($recipients, $headers, $body);



includes/mail.inc文件内容:
请下载Drupal7.12,阅读includes/mail.inc

感激涕零!


回复讨论(解决方案)

自带的mail不行,试试第三方的phpmailer

I forgot to tell you, phpmailer couldn't work on this project web.

如果是wordpress程序可以整合wordpress smtp弄...另外discuz可以自己后台设置,另外sourceforge的邮箱可以用
host: prwebmail
https://sourceforge.net/p/forge/documentation/Project%20Web%20Email/

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template