欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

配置SourceForge SMTP服务器

程序员文章站 2024-01-23 08:56:34
...
这是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/