return;
define('smtp_php', true);
- include('../functions/addressbook.php');
+ require_once('../functions/addressbook.php');
+ require_once('../functions/plugin.php');
global $username, $popuser, $domain;
if (isMultipart()) {
foreach ($attachments as $info)
{
-// echo "<pre>Attachment Info:\n";
-// var_dump($info);
-// echo "\n</pre>\n";
if (isset($info['type']))
$filetype = $info['type'];
else
$header .= "Content-Disposition: attachment; filename=\"" .
$info['remotefilename'] . "\"\r\n";
- $file = fopen ($attachment_dir . $info['localfilename'], 'r');
+ // Use 'rb' for NT systems -- read binary
+ // Unix doesn't care -- everything's binary! :-)
+ $file = fopen ($attachment_dir . $info['localfilename'], 'rb');
if (substr($filetype, 0, 5) == 'text/' ||
$filetype == 'message/rfc822') {
$header .= "\r\n";
$tmp = str_replace("\r\n", "\n", $tmp);
$tmp = str_replace("\r", "\n", $tmp);
$tmp = str_replace("\n", "\r\n", $tmp);
- $tmp .= "\r\n";
+ if (feof($fp) && substr($tmp, -2) != "\r\n")
+ $tmp .= "\r\n";
fputs($fp, $tmp);
$length += strlen($tmp);
}
}
function sendSMTP($t, $c, $b, $subject, $body, $more_headers) {
- global $username, $popuser, $domain, $version, $smtpServerAddress, $smtpPort,
- $data_dir, $color, $use_authenticated_smtp, $identity;
+ global $username, $popuser, $domain, $version, $smtpServerAddress,
+ $smtpPort, $data_dir, $color, $use_authenticated_smtp, $identity,
+ $key, $onetimepad;
$to = expandAddrs(parseAddrs($t));
$cc = expandAddrs(parseAddrs($c));
$tmp = fgets($smtpConnection, 1024);
if (errorCheck($tmp, $smtpConnection)!=5) return(0);
- fputs($smtpConnection, base64_encode ($OneTimePadDecrypt($key, $onetimepad)) . "\r\n");
+ fputs($smtpConnection, base64_encode (OneTimePadDecrypt($key, $onetimepad)) . "\r\n");
$tmp = fgets($smtpConnection, 1024);
if (errorCheck($tmp, $smtpConnection)!=5) return(0);
}
if ($num != 250) {
$tmp = nl2br(htmlspecialchars($tmp));
displayPageHeader($color, 'None');
- include ("../functions/display_messages.php");
+ include_once('../functions/display_messages.php');
$msg = "Message not sent!<br>\nReason given: $tmp";
plain_error_message($msg, $color);
return(0);
function errorCheck($line, $smtpConnection, $verbose = false) {
global $color;
- include '../functions/page_header.php';
// Read new lines on a multiline response
$lines = $line;
}
if ($status == 0) {
+ include_once('../functions/page_header.php');
displayPageHeader($color, 'None');
- include ("../functions/display_messages.php");
+ include_once('../functions/display_messages.php');
$lines = nl2br(htmlspecialchars($lines));
$msg = $message . "<br>\nServer replied: $lines";
plain_error_message($msg, $color);
function sendMessage($t, $c, $b, $subject, $body, $reply_id) {
global $useSendmail, $msg_id, $is_reply, $mailbox, $onetimepad;
global $data_dir, $username, $domain, $key, $version, $sent_folder, $imapServerAddress, $imapPort;
+ global $more_headers;
$more_headers = Array();
+ do_hook("smtp_send");
+
$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 1);
if (isset($reply_id) && $reply_id) {
}
// In order to remove the problem of users not able to create
- // messages with "." on a blank line, RFC821 has made provision
- // in section 4.5.2 (Transparency).
- $body = ereg_replace("\n\\.", "\n..", $body);
- $body = ereg_replace("^\\.", "..", $body);
+ // messages with "." on a blank line, RFC821 has made provision
+ // in section 4.5.2 (Transparency).
+ $body = ereg_replace("\n\\.", "\n..", $body);
+ $body = ereg_replace("^\\.", "..", $body);
// this is to catch all plain \n instances and
- // replace them with \r\n.
- $body = ereg_replace("\r\n", "\n", $body);
+ // replace them with \r\n. All newlines were converted
+ // into just \n inside the compose.php file.
$body = ereg_replace("\n", "\r\n", $body);
if ($useSendmail) {
return $length;
}
-
-?>
+
+?>
\ No newline at end of file