Hi,
If your user community prefers the old email layout but you do not like to see the complete thread in the email, this code limits the included messages to two.
The modification assumes that the following options have been selected:
AdminCP - vBulletin Options - Email Integration Settings:- Use Single From Address
- Do you want to use the old layout for emails
You have to fill in these options:
- Single From Name
- Single From Address
How to modify:
Insert the modification after line 264 in includes/cron/emailintegration.php:
Code:
$mailmessage = preg_replace($pattern, $replace, $mailmessage);
Modification:
Code:
// 20080916 toivo@totaldata.biz: remove all but last message, leave one delimiter
// ei options set: 'use old email layout', 'use single from: address', 'single from name', 'single from address'
$from_str = 'From: ' . $vbulletin->options['ei_single_from_name'] . ' ';
$from_str .= '[mailto:' .$vbulletin->options['ei_single_from_address'] .']';
// remove text inserted by Outlook, possibly other clients
$original_str = '-----Original Message-----';
$underscore_str = '________________________________';
$first_pos = strpos($mailmessage, $from_str);
if ($first_pos !== false) {
$second_pos = strpos($mailmessage, $from_str, $first_pos + 1);
if ($second_pos !== false) {
$mailmessage = substr($mailmessage, 0, $second_pos);
// remove last '----- Original Message -----'
$first_orig_pos = strpos($mailmessage, $original_str);
if ($first_orig_pos !== false) {
$last_orig_pos = strrpos($mailmessage, $original_str);
if ($last_orig_pos !== false AND $last_orig_pos !== $first_orig_pos) {
$mailmessage = substr_replace($mailmessage, '', $last_orig_pos, strlen($original_str));
}
} else {
$first_us_pos = strpos($mailmessage, $underscore_str);
if ($first_us_pos !== false) {
$last_us_pos = strrpos($mailmessage, $underscore_str);
if ($last_us_pos !== false AND $last_us_pos !== $first_us_pos) {
$mailmessage = substr_replace($mailmessage, '', $last_us_pos, strlen($underscore_str));
}
}
}
}
}
// 20080916 end
Regards,
toivo