You are here

function campaignmonitor_form_submit in Campaign Monitor 5

Same name and namespace in other branches
  1. 5.2 campaignmonitor.module \campaignmonitor_form_submit()

File

./campaignmonitor.module, line 357

Code

function campaignmonitor_form_submit($form_id, $form_values) {
  if ($form_values['subscribe_newsletter']) {
    if ('contact_mail_page' == $form_id) {
      $form_values['message'] .= "\n\n" . t('Subscribed to newsletter.');
    }

    // Replace api_key and list_id with your own details
    $api_key = variable_get('campaignmonitor_api_key', '');
    $list_id = variable_get('campaignmonitor_list_id', 0);
    $email = $form_values['mail'];
    $name = $form_values['name'];
    _campaignmonitor_add_subscriber($api_key, $list_id, $name, $email);
  }
}