** - Start new mail
** - Add an attachment
** - Send mail
+ **
+ ** $Id$
**/
session_start();
- if (!isset($config_php))
- include("../config/config.php");
if (!isset($strings_php))
include("../functions/strings.php");
+ if (!isset($config_php))
+ include("../config/config.php");
if (!isset($page_header_php))
include("../functions/page_header.php");
if (!isset($imap_php))
include("../src/load_prefs.php");
+ if (!isset($attachments))
+ $attachments = array();
+
// This function is used when not sending or adding attachments
function newMail () {
global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
$id = $reply_id;
- if ($id) {
+ if (isset($id)) {
sqimap_mailbox_select($imapConnection, $mailbox);
$message = sqimap_get_message($imapConnection, $id, $mailbox);
$orig_header = $message->header;
$body = $bodyTop . $body;
}
- $body = ereg_replace('\\\\', '\\\\', $body);
-
return;
}
// Write Attachment to file
$fp = fopen ($attachment_dir.$localfilename, "w");
fputs ($fp, decodeBody(mime_fetch_body($imapConnection, $forward_id, $message->header->entity_id), $message->header->encoding));
-
-// Don't know why these lines were included
-// fgets($imapConnection, 256);
-// fgets($imapConnection, 256);
-
fclose ($fp);
$attachments[$localfilename] = $filename;
echo " <TD BGCOLOR=\"$color[0]\" VALIGN=TOP ALIGN=RIGHT>\n";
echo " <SMALL><BR></SMALL>"._("Attach:");
echo " </td><td ALIGN=left BGCOLOR=\"$color[0]\">\n";
- // echo " <INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\"\n";
- // echo " value=\"10000\">\n";
echo " <INPUT NAME=\"attachfile\" SIZE=48 TYPE=\"file\">\n";
echo " <input type=\"submit\" name=\"attach\"";
echo " value=\"" . _("Add") ."\">\n";
}
}
- if (!$failed) {
+ if (!isset($failed) || !$failed) {
// Write information about the file
$fp = fopen ($attachment_dir.$localfilename.".info", "w");
fputs ($fp, $HTTP_POST_FILES['attachfile']['type']."\n".$HTTP_POST_FILES['attachfile']['name']."\n");
}
}
- if (($mailbox == "") || ($mailbox == "None"))
+ // Workaround for RedHat PHP 4.0.4pl1-3
+ // Also for Konq problems?
+ if (isset($mailbox)) $mailbox = trim($mailbox);
+ if (isset($send_to)) $send_to = trim($send_to);
+ if (isset($send_to_cc)) $send_to_cc = trim($send_to_cc);
+ if (isset($send_to_bcc)) $send_to_bcc = trim($send_to_bcc);
+ if (isset($subject)) $subject = trim($subject);
+ if (isset($body)) $body = trim($body);
+ if (isset($attachfile)) $attachfile = trim($attachfile);
+ // End of workaround
+
+ if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
$mailbox = "INBOX";
if(isset($send)) {
- if ($HTTP_POST_FILES['attachfile']['tmp_name'] &&
+ if (isset($HTTP_POST_FILES['attachfile']) &&
+ $HTTP_POST_FILES['attachfile']['tmp_name'] &&
$HTTP_POST_FILES['attachfile']['tmp_name'] != 'none')
$AttachFailure = saveAttachedFiles();
- if (checkInput(false) && ! $AttachFailure) {
- $urlMailbox = urlencode ($mailbox);
+ if (checkInput(false) && !isset($AttachFailure)) {
+ $urlMailbox = urlencode (trim($mailbox));
+ if (! isset($reply_id))
+ $reply_id = 0;
sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id);
header ("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1");
} else {
showInputForm();
//sqimap_logout($imapConnection);
}
- } else if ($html_addr_search_done) {
+ } else if (isset($html_addr_search_done)) {
is_logged_in();
displayPageHeader($color, $mailbox);
}
showInputForm();
- } else if ($html_addr_search) {
+ } else if (isset($html_addr_search)) {
// I am using an include so as to elminiate an extra unnecessary click. If you
// can think of a better way, please implement it.
include ("./addrbook_search_html.php");
}
showInputForm();
- } else if ($smtpErrors) {
+ } else if (isset($smtpErrors)) {
$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
displayPageHeader($color, $mailbox);
$newmail = true;
- if ($forward_id && $ent_num) getAttachments(0);
+ if (isset($forward_id) && isset($ent_num)) getAttachments(0);
newMail();
showInputForm();
sqimap_logout($imapConnection);
}
?>
-
-