[patch] enable multiline mailto

Corey Innis corey at coolerator.net
Mon Nov 28 03:06:02 CET 2005


Hi,

below I've included a patch for sendmail.inc to enable multilines  
(and semicolons) in the mailto, cc, and bcc fields. I hope you find  
it useful.

Really enjoying RoundCube mail!

cheers,
Corey

----- BEGIN PATCH -----
69,73c69,77
<
< $mailto_regexp = '/,\s*$/';
<
< // trip ending ', ' from
< $mailto = preg_replace($mailto_regexp, '', $_POST['_to']);
---
 > // regex patterns
 > $mailto_regexp_newlines = '/[,;]*\s*\r\n/';
 > $mailto_regexp_trail = '/,\s*$/';
 >
 > $mailto = $_POST['_to'];
 >
 > // convert newlines/semicolons and strip trailing ', ' in mailto
 > $mailto = preg_replace($mailto_regexp_newlines, ',', $mailto);
 > $mailto = preg_replace($mailto_regexp_trail, '', $mailto);
94,98c98,108
< if ($_POST['_cc'])
<   $headers['Cc'] = preg_replace($mailto_regexp, '', $_POST['_cc']);
<
< if ($_POST['_bcc'])
<   $headers['Bcc'] = preg_replace($mailto_regexp, '', $_POST['_bcc']);
---
 > if ($_POST['_cc']) {
 >   $mailcc = $_POST['_cc'];
 >   $mailcc = preg_replace($mailto_regexp_newlines, ',', $mailcc);
 >   $headers['Cc'] = preg_replace($mailto_regexp_trail, '', $mailcc);
 > }
 >
 > if ($_POST['_bcc']) {
 >   $mailbcc = $_POST['_bcc'];
 >   $mailbcc = preg_replace($mailto_regexp_newlines, ',', $mailbcc);
 >   $headers['Bcc'] = preg_replace($mailto_regexp_trail, '', $mailbcc);
 > }
267c277
< ?>
\ No newline at end of file
---
 > ?>
----- END PATCH -----





More information about the Dev mailing list