function sendMailChimpNotification() { $mainframe = JFactory::getApplication(); // listSubscribe(string apikey, string id, string email_address, array merge_vars, string email_type, boolean double_optin, boolean update_existing, boolean replace_interests, boolean send_welcome) if (!class_exists('MCAPI')) { require_once JPATH_SITE . '/administrator/components/com_breezingforms/libraries/mailchimp/MCAPI.class.php'; } if (trim($this->formrow->mailchimp_email_field) != '' && trim($this->formrow->mailchimp_api_key) != '' && trim($this->formrow->mailchimp_list_id) != '' && count($this->maildata)) { $email = ''; $htmlTextMobile = 'text'; $checked = true; $unsubsribe = false; $mergeVars = array(); $htmlTextMobileField = trim($this->formrow->mailchimp_text_html_mobile_field); $checkboxField = trim($this->formrow->mailchimp_checkbox_field); $unsubscribeField = trim($this->formrow->mailchimp_unsubscribe_field); $emailField = trim($this->formrow->mailchimp_email_field); $mergeVarFields = explode(',', str_replace(' ', '', $this->formrow->mailchimp_mergevars)); $api = new MCAPI(trim($this->formrow->mailchimp_api_key)); $list_id = trim($this->formrow->mailchimp_list_id); if ($checkboxField != '') { $box = JRequest::getVar('ff_nm_' . $checkboxField, array('')); if (isset($box[0]) && $box[0] != '') { $checked = true; } else { $checked = false; } } if ($unsubscribeField != '') { $box = JRequest::getVar('ff_nm_' . $unsubscribeField, array('')); if (isset($box[0]) && $box[0] != '') { $unsubsribe = true; } } if ($htmlTextMobileField != '') { $selection = JRequest::getVar('ff_nm_' . $htmlTextMobileField, array('')); if (isset($selection[0]) && $selection[0] != '') { $htmlTextMobile = $selection[0]; } } else { $htmlTextMobile = $this->formrow->mailchimp_default_type; } foreach ($this->maildata as $data) { switch ($data[_FF_DATA_NAME]) { case $emailField: $email = bf_is_email(trim($data[_FF_DATA_VALUE])) ? trim($data[_FF_DATA_VALUE]) : ''; break; default: if (in_array($data[_FF_DATA_NAME], $mergeVarFields)) { $mergeVars[$data[_FF_DATA_NAME]] = $data[_FF_DATA_VALUE]; } } } if ($email != '' && $checked) { if ($api->listSubscribe($list_id, $email, count($mergeVars) == 0 ? '' : $mergeVars, $htmlTextMobile, $this->formrow->mailchimp_double_optin, $this->formrow->mailchimp_update_existing, $this->formrow->mailchimp_replace_interests, $this->formrow->mailchimp_send_welcome) !== true) { if ($this->formrow->mailchimp_send_errors) { $from = $this->formrow->alt_mailfrom != '' ? $this->formrow->alt_mailfrom : $mainframe->getCfg('mailfrom'); $fromname = $this->formrow->alt_fromname != '' ? $this->formrow->alt_fromname : $mainframe->getCfg('fromname'); $this->sendMail($from, $fromname, $from, 'MailChimp API Error', 'Could not send data to MailChimp for email: ' . $email . "\n\nReason (code " . $api->errorCode . "): " . $api->errorMessage); } } } if ($email != '' && $unsubsribe) { if ($api->listUnsubscribe($list_id, $email, $this->formrow->mailchimp_delete_member, $this->formrow->mailchimp_send_goodbye, $this->formrow->mailchimp_send_notify) !== true) { if ($this->formrow->mailchimp_send_errors) { $from = $this->formrow->alt_mailfrom != '' ? $this->formrow->alt_mailfrom : $mainframe->getCfg('mailfrom'); $fromname = $this->formrow->alt_fromname != '' ? $this->formrow->alt_fromname : $mainframe->getCfg('fromname'); $this->sendMail($from, $fromname, $from, 'MailChimp API Error', 'Could not send unsubscribe data to MailChimp for email: ' . $email . "\n\nReason (code " . $api->errorCode . "): " . $api->errorMessage); } } } } }
$mailer->Body .= BFText::_('COM_BREEZINGFORMS_BIC') . ': ' . JRequest::getVar('sender_bank_bic', '') . "\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_IBAN') . ': ' . JRequest::getVar('sender_iban', '') . "\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_PAYMENT_DATE') . ': ' . JRequest::getVar('created', '') . "\n\n"; $mailer->Body .= '--------------------------------------' . "\n\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_RECEIPT_FOR_YOUR_PAYMENT') . "\n\n"; $mailer->Body .= '--------------------------------------' . "\n\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_ACCOUNT_HOLDER') . ': ' . JRequest::getVar('recipient_holder', '') . "\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_ACCOUNT_NUMBER') . ': ' . JRequest::getVar('recipient_account_number', '') . "\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_BANK_CODE') . ': ' . JRequest::getVar('recipient_bank_code', '') . "\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_BANK_NAME') . ': ' . JRequest::getVar('recipient_bank_name', '') . "\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_BIC') . ': ' . JRequest::getVar('recipient_bank_bic', '') . "\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_IBAN') . ': ' . JRequest::getVar('recipient_iban', '') . "\n\n"; $mailer->Body .= '--------------------------------------' . "\n\n"; $mailer->Body .= BFText::_('COM_BREEZINGFORMS_PAYMENT_GATEWAY_SU'); for ($i = 0; $i < $recipientsSize; $i++) { if (bf_is_email($recipients[$i])) { $mailer->AddAddress($recipients[$i]); $mailer->Send(); } } // trigger a script after succeeded payment? if (JFile::exists(JPATH_SITE . '/bf_sofortueberweisung_success.php')) { require_once JPATH_SITE . '/bf_sofortueberweisung_success.php'; } // send mail after succeeded payment? if (isset($options['sendNotificationAfterPayment']) && $options['sendNotificationAfterPayment']) { bf_sendNotificationByPaymentCache($formId, $recordId, 'admin'); bf_sendNotificationByPaymentCache($formId, $recordId, 'mailback'); } } }