test email attachments
This commit is contained in:
@@ -325,7 +325,14 @@ function _booking_custom_email($nid, $email_type, $sender = 'contact') {
|
||||
//calculate the from email address for a logistics email
|
||||
$from = t('!event Registrations <!email>', array('!event' => $event->booking_eventname,
|
||||
'!email' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')))
|
||||
));
|
||||
));
|
||||
// Test email attachments with dummy file
|
||||
$attachment = array(
|
||||
'filecontent' => file_get_contents(DRUPAL_ROOT . '/README.txt'),
|
||||
'filename' => 'test.txt',
|
||||
'filemime' => 'text/plain',
|
||||
);
|
||||
$params['attachments'][] = $attachment;
|
||||
}
|
||||
|
||||
//load the node matching this id
|
||||
|
@@ -593,13 +593,11 @@ function booking_manual_email_form($form, &$form_state)
|
||||
);
|
||||
|
||||
//add in the custom email types
|
||||
for ($i = 1; $i <= variable_get('booking_custom_email_count','5'); $i++)
|
||||
{
|
||||
for ($i = 1; $i <= variable_get('booking_custom_email_count','5'); $i++) {
|
||||
$email_options_array['custom' . $i] = variable_get('booking_email_subject_custom' . $i, $event->booking_eventname . ' custom ' . $i);
|
||||
}
|
||||
//add in the custom email types from logistics
|
||||
for ($i = 1; $i <= 5; $i++)
|
||||
{
|
||||
for ($i = 1; $i <= 5; $i++) {
|
||||
$email_options_array['customlogistics' . $i] = variable_get('booking_email_subject_customlogistics' . $i,
|
||||
$event->booking_eventname . ' logistics custom ' . $i) . " **Logistics**";
|
||||
}
|
||||
@@ -664,14 +662,13 @@ function booking_manual_email_form($form, &$form_state)
|
||||
'#value' => t('Send Email'),
|
||||
);
|
||||
|
||||
if (variable_get('booking_enable_travelform', 0) == 1) {
|
||||
if (variable_get('booking_enable_travelform', 0) == 1) {
|
||||
$header['travel_form'] = array('data' => t('Travel Submitted?'), 'field' => 'tid');
|
||||
}
|
||||
|
||||
|
||||
//query the database for studygroup info if it is enabled
|
||||
if (variable_get('booking_enable_studygroups', 0) == 1)
|
||||
{
|
||||
if (variable_get('booking_enable_studygroups', 0) == 1) {
|
||||
//select entries from the study groups mapping table
|
||||
$query = db_select('booking_studygroup_mapping', 'm');
|
||||
$query->join('booking_studygroup_list', 's', 's.sid = m.booking_studygroup_id');
|
||||
|
@@ -974,6 +974,12 @@ function booking_mail($key, &$message, $params) {
|
||||
$message['headers'] += $params['headers'];
|
||||
}
|
||||
|
||||
// Add attachment when available.
|
||||
// From https://drupal.stackexchange.com/questions/101035/send-attachments-with-drupal-mail
|
||||
if (isset($params['attachment'])) {
|
||||
$message['params']['attachments'][] = $params['attachment'];
|
||||
}
|
||||
|
||||
//watchdog('booking_debug', "<pre>Mail hook:\n@info</pre>", array('@info' => print_r( $message, true)));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user