我开始了解drupal,我执行发送邮件的功能,但失败了。请帮我:
$params = array(
'subject' => 'hello',
'body' => 'test',);
$from='nguyen.xuan.luan@vinicorp.com.vn';
$to = 'nguyen.xuan.luan@vinicorp.com.vn';
$mail = drupal_mail('exampe', 'notice', $to, language_default(), $params, $from, TRUE);错误信息:无法发送电子邮件.如果问题仍然存在,请与站点管理员联系。
我认为必须有邮件密码的信息,但我不知道如何。能帮我吗?
发布于 2015-10-06 13:44:32
您需要在您的hook_mail文件中创建一个钩子,即.module,并在其中设置消息主题和正文。下面是代码的工作hook_mail()实现-
function exampe_mail($key, &$message, $params) {
switch($key) {
//switching on $key lets you create variations of the email based on the $key parameter
case 'notice':
$message['subject'] = t('Subject');
//the email body is here, inside the $message array
$message['body'][] = 'This is the body of the email';
break;
}
}https://stackoverflow.com/questions/32884633
复制相似问题