[imp] Trailing dot in e-mail address
Patrick Boutilier
boutilpj at ednet.ns.ca
Mon Oct 4 07:27:13 PDT 2004
On 09/28/2004 12:37 PM, Patrick Boutilier wrote:
> A user reported that mail they were sending was showing up in their
> sent-mail folder but not being delivered to any recipients. After
> investigating it turns out the contact list that she was using had an
> e-mail address with a period/dot at the end of it (user at ednet.ns.ca.)
>
>
> <snip>
>
> Horde 2.2.6
> IMP 3.2.6
Here are two patches against Horde 2.2.6 and IMP 3.2.6 to give an error
when composing an e-mail to an address with a trailing period/dot at the
end of it instead of just failing silently. I just followed the same
logic as the is8bit function.
-------------- next part --------------
*** horde/lib/MIME.php.orig 2003-01-14 19:38:36.000000000 -0400
--- horde/lib/MIME.php 2004-10-04 11:17:31.000000000 -0300
***************
*** 58,67 ****
--- 58,85 ----
return false;
}
}
/**
+ * Determine if a string contains a period at the end.
+ *
+ * @access public
+ *
+ * @param string $string The string to check.
+ *
+ * @return boolean True if string contains a period at the end.
+ */
+ function periodatend($string)
+ {
+ if (is_string($string) && preg_match('/\.$/', $string)) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ /**
* Encode a string containing non-ASCII characters according to RFC 2047.
*
* @access public
*
* @param string $text The text to encode.
-------------- next part --------------
*** imp/compose.php.orig 2004-06-09 14:00:58.000000000 -0300
--- imp/compose.php 2004-10-03 20:45:39.000000000 -0300
***************
*** 692,701 ****
--- 692,710 ----
$get_sig = false;
break 2;
}
}
+ /* Check for a period at the end in addresses. */
+ foreach (IMP::bareAddress($recipients, true) as $val) {
+ if (MIME::periodatend($val)) {
+ Horde::raiseMessage(_("One or more periods at end in e-mail address."), HORDE_ERROR);
+ $get_sig = false;
+ break 2;
+ }
+ }
+
$orig_headers = @imap_fetchheader($imp['stream'], $index, FT_UID);
$orig_headers = str_replace("\r", '', $orig_headers);
$header_arr = explode("\n", $orig_headers);
foreach ($header_arr as $header) {
***************
*** 773,782 ****
--- 782,800 ----
$get_sig = false;
break 2;
}
}
+ /* Check for a period at the end in addresses. */
+ foreach (IMP::bareAddress($recips, true) as $val) {
+ if (MIME::periodatend($val)) {
+ Horde::raiseMessage(_("One of more periods at end in e-mail address."), HORDE_ERROR);
+ $get_sig = false;
+ break 2;
+ }
+ }
+
if (empty($f_to) && empty($f_cc) && empty($f_bcc)) {
$get_sig = false;
Horde::raiseMessage(_("You must have at least one recipient."), HORDE_ERROR);
break;
} else {
More information about the imp
mailing list