[dev] Re: [cvs] commit: imp compose.php
Jon Parise
jon@csh.rit.edu
Sat, 4 Nov 2000 02:57:18 -0500
On Sat, Nov 04, 2000 at 01:36:30AM -0500, Chuck Hagenbuch wrote:
> Actually, that's a good point - technically, I believe a message is
> legal if it has one of To:, Cc: , or Bcc:.
This patch should cover all of those possibilities. It appears to
work for me, anyway.
--
Jon Parise (jon@csh.rit.edu) . Rochester Inst. of Technology
http://www.csh.rit.edu/~jon/ : Computer Science House Member
Index: compose.php
===================================================================
RCS file: /cvs/horde/imp/compose.php,v
retrieving revision 2.215
diff -u -r2.215 compose.php
--- compose.php 2000/11/03 21:35:49 2.215
+++ compose.php 2000/11/04 07:55:49
@@ -602,8 +602,8 @@
if (isset($attachments_type) && !is_array($attachments_type)) {
$attachments = array($attachments_type);
}
-
- if ($to && isset($message)) {
+
+ if (isset($message) && (!empty($to) || !empty($cc) || !empty($bcc))) {
$message = str_replace("\r\n", "\n", $message);
$mime = new MimeMessage($message, $imp['maildomain']);
@@ -639,20 +639,22 @@
$headers['Message-ID'] = '<' . uniqid(time() . '.') . '@' . $SERVER_NAME . '>';
$headers['Date'] = rfcdate();
-
- $to = format_addresses($to);
- $headers['To'] = $to;
+
$headers['From'] = $from;
- $recipients = $to;
+ if (!empty($to)) {
+ $to = format_addresses($to);
+ $headers['To'] = $to;
+ $recipients = $to;
+ }
if ($conf['compose']['allow_cc'] && !empty($cc)) {
$cc = format_addresses($cc);
$headers['Cc'] = $cc;
- $recipients .= ', ' . $cc;
+ $recipients = (empty($recipients)) ? $cc : "$recipients, $cc";
}
if ($conf['compose']['allow_bcc'] && !empty($bcc)) {
$bcc = format_addresses($bcc);
$headers['Bcc'] = $bcc;
- $recipients .= ', ' . $bcc;
+ $recipients = (empty($recipients)) ? $bcc : "$recipients, $bcc";
}
if (isset($subject) && $subject) {
$headers['Subject'] = $subject;