X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fsmtp.php;h=049b8da20a0bcb3d3d5f6c169fb3e68c836d29a0;hb=62d9ff4d1f893c2f4fc513f984fb5cff4014e316;hp=5e39ad40e0e936192ed04cb88e0db97778729812;hpb=17ce84673639e19c0d01cd6b59caea1732b1433f;p=squirrelmail.git diff --git a/functions/smtp.php b/functions/smtp.php index 5e39ad40..049b8da2 100644 --- a/functions/smtp.php +++ b/functions/smtp.php @@ -1,4 +1,4 @@ -"; else $from = $from . " <$from_addr>"; + + /* Encoding 8-bit characters */ + $subject = encodeHeader($subject); + $from = encodeHeader($from); /* This creates an RFC 822 date */ $date = date("D, j M Y H:i:s ", mktime()) . timezone(); @@ -144,7 +148,7 @@ /* Make an RFC822 Received: line */ $header = "Received: from $REMOTE_ADDR by $SERVER_NAME with HTTP; "; - $header .= "$date\n"; + $header .= "$date\r\n"; /* Insert the rest of the header fields */ $header .= "Message-ID: $message_id\r\n"; @@ -170,7 +174,7 @@ $header .= "X-Mailer: SquirrelMail (version $version)\r\n"; // Identify SquirrelMail // Do the MIME-stuff - $header .= "MIME-Version: 1.0\n"; + $header .= "MIME-Version: 1.0\r\n"; if (isMultipart()) { $header .= "Content-Type: multipart/mixed; boundary=\""; @@ -212,7 +216,7 @@ $body .= stripslashes($passedBody) . "\r\n"; fputs ($fp, $body); - $attachmentlenght = attachFiles($fp); + $attachmentlength = attachFiles($fp); $postbody .= "\r\n--".mimeBoundary()."--\r\n\r\n"; fputs ($fp, $postbody); @@ -254,7 +258,7 @@ function sendSMTP($t, $c, $b, $subject, $body) { global $username, $domain, $version, $smtpServerAddress, $smtpPort, - $data_dir; + $data_dir, $color; $to = parseAddrs($t); $cc = parseAddrs($c); @@ -316,7 +320,7 @@ $tmp = nl2br(htmlspecialchars(fgets($smtpConnection, 1024))); $num = errorCheck($tmp); if ($num != 250) { - echo "ERROR
Message not sent!
Reason given: $tmp
"; + echo "ERROR
Message not sent!
Reason given: $tmp
"; } fputs($smtpConnection, "QUIT\r\n"); // log off @@ -328,6 +332,7 @@ function errorCheck($line) { + global $color; // Status: 0 = fatal // 5 = ok @@ -409,7 +414,7 @@ } if ($status == 0) { - echo ""; + echo ""; echo ""; echo "
ERROR

"; echo "   Error Number: $err_num
"; @@ -423,8 +428,8 @@ } function sendMessage($t, $c, $b, $subject, $body) { - global $useSendmail; - global $data_dir, $username, $domain, $key, $version, $sent_folder, $imapServerAddress; + global $useSendmail, $msg_id, $is_reply; + global $data_dir, $username, $domain, $key, $version, $sent_folder, $imapServerAddress, $imapPort; if ($useSendmail==true) { $length = sendSendmail($t, $c, $b, $subject, $body); @@ -432,21 +437,15 @@ $length = sendSMTP($t, $c, $b, $subject, $body); } - - // This is a proposed interface to save messages in the sent folder - // -- gustavf - // - // $imap_stream = sqimap_login($username, $key, $imapServerAddress, 1); - // sqimap_append ($imap_stream, $sent_folder, $length); - // write822Header ($imap_stream, .....); - // writeBody ($imap_stream, ....); - // sqimap_append_done($imap_stream); - // - // Or something like that... - + $imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 1); + if (sqimap_mailbox_exists ($imap_stream, $sent_folder)) { + sqimap_append ($imap_stream, $sent_folder, $length); + write822Header ($imap_stream, $t, $c, $b, $subject); + writeBody ($imap_stream, $body); + sqimap_append_done ($imap_stream); + } + // Delete the files uploaded for attaching (if any). deleteAttachments(); - } - ?>