0

We have a Drupal 6 contact us Webform with e-mail. There is a custom template with the following fields: Facility: %value[facility] First Name: %value[first_name] Last Name: %value[last_name] Email: %value[email_address] Phone: %value[phone_number] I wish to be contacted: %value[contact_user] Subject: %value[subject] Comments: %value[comments] The results of this submission may be viewed at: %submission_url

I want to access both the subject and the facility field. I'm not sure my keys are correct using "headers". Is this the correct way to access both the subject and facility fields?

Here is my code in the custom module test:

test_mail_alter(&$message)
{

    if (($message['id'] == 'contact_us'))
    {
        $mail_listing = array();

        // pick up subject e-mails
        $subject = str_replace(' ','',$message['headers']['subject']);
        $subject_listing = explode(',',$subject);
        foreach ($subject_listing as $s){

            if (preg_match('/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/',$s)){
                array_push($mail_listing,$s);
            }

        }

        // pick up facility if it exists and combine it with the subject listing
        $facility = str_replace(' ','',$message['headers']['facility']);
        $facility_listing = explode(',',$facility);
        foreach ($facility_listing as $f){

            if (preg_match('/[a-zA-Z0-9_-.+]+@[a-zA-Z0-9-]+.[a-zA-Z]+/',$f)){
                array_push($mail_listing,$f);
            }

        }

        $message['headers']['to'] = implode(',',$mail_listing);
    }
}
-1

In Drupal 6, you can specify further settings:

  • Navigate to the Contact Form settings page (http://example.com/admin/build/contact/settings)
  • In the "Additional Information" section, enter the text to display with the contact form.
  • In the "Hourly Threshold" list, select the maximum number of submissions that a user can make per hour.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.