我想将以下代码放入Drupal7的include / mail.inc中,以便我可以从SourceForge的项目网站空间发送邮件。不要求我安装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);
答案 0 :(得分:0)
如果此代码可以成功发送没有drupal7的电子邮件(你必须确保它) 然后你可以用三种方式做到这一点: