如何发送邮件到drupal 7 [英] how to send email in drupal 7
本文介绍了如何发送邮件到drupal 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有可以帮助用drupal 7发送电子邮件的示例源代码。
可以帮助contact_submit函数使用 drupal_mail()。
我正在使用自定义模块:
Does any can help with an example source code to send email in drupal 7. Can any one help with the contact_submit function to use drupal_mail(). I'm using custom module :
function contact_menu() {
$items['contact'] = array(
'title' => 'contact form',
'page callback' => 'drupal_get_form',
'page arguments' => array('contact_form'),
'access arguments' => array('access content'),
);
return $items;
}
function contact_form() {
$form['intro'] = array(
'#markup' => t('Use this form to send a message to an e-mail address. No spamming!'),
);
$form['email'] = array(
'#type' => 'textfield',
'#title' => t('E-mail address'),
'#required' => TRUE,
);
$form['message'] = array(
'#type' => 'textarea',
'#title' => t('Message'),
'#required' => TRUE,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit'),
);
return $form;
}
function contact_validate($form, &$form_state) {
if (!valid_email_address($form_state['values']['email'])) {
form_set_error('email', t('That e-mail address is not valid.'));
}
}
function contact_form_submit($form, &$form_state) {
//What i should write here ???
}
推荐答案
示例模块包含示例数开始使用,包括电子邮件。
请参阅api站点此处
请参阅 drupal_mail()功能,以查看函数参数和用户示例作为功能使用。
Examples module contains number of examples to get started with, including emails. see it in api site here See drupal_mail() function to see function params and user examples as well as function use.
GIYF。
这篇关于如何发送邮件到drupal 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文