Autoresponder with WebForm
Put this code in webform->edit>"Advanced Setting"->"Advanced Processing" and make changes according to your requirement. This code would be executed when the webform is submitted.
<?php foreach ($form_values['submitted'] as $field_id => $value) {
$component = $node->webformcomponents[$field_id];
if ($component['name'] == "Email Address" && valid_email_address($value)) {
$fromEmail = $value;
}
if ($component['name'] == "First Name") {
$fromName = $value;
}
}
$toemail = $form_values['submitted']['1197459807'];
$fromName = $form_values['submitted']['1197459739'];
$message = "$fromName,\n"
. "\n"
. "Thank you for visiting our web site. We shall contact you shortly. \n"
. "\n"
. "Thank you, \n NTB Team"
. "";
$subject = "Message from me";
$mailkey = "reply_anon";
$to = $toemail; //$fromEmail;
$from = "mysite@gmail.com";
drupal_mail($mailkey, $to, $subject, $message, $from);
?>
- address value
- advanced processing
- amp
- field id
- lt
- ntb
- php foreach
- quot quot
- valid email address
- webform
- programmer's blog
- login or register to post comments