* HTML cleaned up a bit
[squirrelmail.git] / src / compose.php
CommitLineData
59177427 1<?php
ef870322 2 /**
3 ** compose.php
4 **
5 ** Copyright (c) 1999-2000 The SquirrelMail development team
6 ** Licensed under the GNU GPL. For full terms see the file COPYING.
7 **
8 ** This code sends a mail.
df15de21 9 **
10 ** There are 3 modes of operation:
11 ** - Start new mail
12 ** - Add an attachment
13 ** - Send mail
245a6892 14 **
15 ** $Id$
df15de21 16 **/
d51894be 17
2a32fc83 18 session_start();
19
d068c0ec 20 if (!isset($strings_php))
21 include("../functions/strings.php");
245a6892 22 if (!isset($config_php))
23 include("../config/config.php");
d068c0ec 24 if (!isset($page_header_php))
25 include("../functions/page_header.php");
26 if (!isset($imap_php))
27 include("../functions/imap.php");
28 if (!isset($date_php))
29 include("../functions/date.php");
30 if (!isset($mime_php))
31 include("../functions/mime.php");
32 if (!isset($smtp_php))
33 include("../functions/smtp.php");
34 if (!isset($display_messages_php))
35 include("../functions/display_messages.php");
3c13b9fb 36 if (!isset($auth_php))
37 include ("../functions/auth.php");
15bfc1bc 38 if (!isset($plugin_php))
39 include ("../functions/plugin.php");
f7fb20fe 40
d3cdb279 41 include("../src/load_prefs.php");
8467bf00 42
79be8a0b 43 if (!isset($attachments))
a4fe5de0 44 {
79be8a0b 45 $attachments = array();
a4fe5de0 46 }
47
4ba45d11 48 // This function is used when not sending or adding attachments
df15de21 49 function newMail () {
50 global $forward_id, $imapConnection, $msg, $ent_num, $body_ary, $body,
a794e82c 51 $reply_id, $send_to, $send_to_cc, $mailbox, $send_to_bcc, $editor_size;
e39d73e5 52
d51894be 53 $send_to = decodeHeader($send_to);
54 $send_to_cc = decodeHeader($send_to_cc);
55 $send_to_bcc = decodeHeader($send_to_bcc);
a53e5469 56
429f8906 57 if ($forward_id)
58 $id = $forward_id;
3b5b889f 59 elseif ($reply_id)
429f8906 60 $id = $reply_id;
61
1195c340 62
245a6892 63 if (isset($id)) {
813eba2f 64 sqimap_mailbox_select($imapConnection, $mailbox);
429f8906 65 $message = sqimap_get_message($imapConnection, $id, $mailbox);
8d8ab69a 66 $orig_header = $message->header;
1195c340 67 if ($ent_num)
68 $message = getEntity($message, $ent_num);
429f8906 69
70 if ($message->header->type0 == "text" || $message->header->type1 == "message") {
1195c340 71 if ($ent_num)
72 $body = decodeBody(mime_fetch_body($imapConnection, $id, $ent_num), $message->header->encoding);
73 else
74 $body = decodeBody(mime_fetch_body($imapConnection, $id, 1), $message->header->encoding);
429f8906 75 } else {
76 $body = "";
df15de21 77 }
3bc5ef2d 78
429f8906 79 if ($message->header->type1 == "html")
80 $body = strip_tags($body);
f82d9be2 81
01aab860 82 sqUnWordWrap($body);
a794e82c 83 $body_ary = explode("\n", $body);
fb6ce88e 84 $i = count($body_ary) - 1;
3bc5ef2d 85 while ($i >= 0 && ereg("^[>\\s]*$", $body_ary[$i])) {
fb6ce88e 86 unset($body_ary[$i]);
87 $i --;
441f2d33 88 }
a794e82c 89 $body = "";
3bc5ef2d 90 for ($i=0; isset($body_ary[$i]); $i++) {
01aab860 91 if (! $forward_id)
92 {
f82d9be2 93 if (ereg('^[\\s>]+', $body_ary[$i]))
01aab860 94 {
95 $body_ary[$i] = '>' . $body_ary[$i];
96 }
97 else
98 {
99 $body_ary[$i] = '> ' . $body_ary[$i];
100 }
101 }
a794e82c 102 sqWordWrap($body_ary[$i], $editor_size - 1);
01aab860 103 $body .= $body_ary[$i] . "\n";
f82d9be2 104 unset($body_ary[$i]);
a794e82c 105 }
01aab860 106 if ($forward_id)
107 {
108 $bodyTop = "-------- " . _("Original Message") . " --------\n";
109 $bodyTop .= _("Subject") . ": " . $orig_header->subject . "\n";
110 $bodyTop .= _("From") . ": " . $orig_header->from . "\n";
111 $bodyTop .= _("To") . ": " . $orig_header->to[0] . "\n";
112 if (count($orig_header->to) > 1) {
113 for ($x=1; $x < count($orig_header->to); $x++) {
114 $bodyTop .= " " . $orig_header->to[$x] . "\n";
115 }
116 }
117 $bodyTop .= "\n";
118 $body = $bodyTop . $body;
78509c54 119 }
441f2d33 120
01aab860 121 return;
78509c54 122 }
429f8906 123
29d08a52 124 if (!$send_to) {
125 $send_to = sqimap_find_email($send_to);
126 }
127
df15de21 128 /** This formats a CC string if they hit "reply all" **/
129 if ($send_to_cc != "") {
a48fbf9b 130 $send_to_cc = ereg_replace( '"[^"]*"', "", $send_to_cc);
df15de21 131 $send_to_cc = ereg_replace(";", ",", $send_to_cc);
132 $sendcc = explode(",", $send_to_cc);
133 $send_to_cc = "";
134
135 for ($i = 0; $i < count($sendcc); $i++) {
136 $sendcc[$i] = trim($sendcc[$i]);
137 if ($sendcc[$i] == "")
138 continue;
139
a53e5469 140 $sendcc[$i] = sqimap_find_email($sendcc[$i]);
813eba2f 141 $whofrom = sqimap_find_displayable_name($msg["HEADER"]["FROM"]);
142 $whoreplyto = sqimap_find_email($msg["HEADER"]["REPLYTO"]);
df15de21 143
144 if ((strtolower(trim($sendcc[$i])) != strtolower(trim($whofrom))) &&
145 (strtolower(trim($sendcc[$i])) != strtolower(trim($whoreplyto))) &&
146 (trim($sendcc[$i]) != "")) {
147 $send_to_cc .= trim($sendcc[$i]) . ", ";
148 }
149 }
150 $send_to_cc = trim($send_to_cc);
151 if (substr($send_to_cc, -1) == ",") {
152 $send_to_cc = substr($send_to_cc, 0, strlen($send_to_cc) - 1);
153 }
154 }
155 } // function newMail()
78509c54 156
5713b4f9 157 function getAttachments($message) {
158 global $mailbox, $attachments, $attachment_dir, $imapConnection,
159 $ent_num, $forward_id;
160
161 if (!$message) {
162 sqimap_mailbox_select($imapConnection, $mailbox);
991a059e 163 $message = sqimap_get_message($imapConnection, $forward_id,
164 $mailbox);
165 }
5713b4f9 166
991a059e 167 if (count($message->entities) == 0) {
168 if ($message->header->entity_id != $ent_num) {
169 $filename = decodeHeader($message->header->filename);
5713b4f9 170
991a059e 171 if ($filename == "")
172 $filename = "untitled-".$message->header->entity_id;
5713b4f9 173
991a059e 174 $localfilename = GenerateRandomString(32, '', 7);
3b5b889f 175
991a059e 176 // Write File Info
177 $fp = fopen ($attachment_dir.$localfilename.".info", "w");
178 fputs ($fp, strtolower($message->header->type0)."/".
179 strtolower($message->header->type1)."\n".$filename."\n");
180 fclose ($fp);
181
182 // Write Attachment to file
183 $fp = fopen ($attachment_dir.$localfilename, "w");
184 fputs ($fp, decodeBody(mime_fetch_body($imapConnection,
185 $forward_id, $message->header->entity_id),
186 $message->header->encoding));
187 fclose ($fp);
5713b4f9 188
991a059e 189 $attachments[$localfilename] = $filename;
190 }
5713b4f9 191 } else {
991a059e 192 for ($i = 0; $i < count($message->entities); $i++) {
5713b4f9 193 getAttachments($message->entities[$i]);
991a059e 194 }
5713b4f9 195 }
196 return;
991a059e 197 }
5713b4f9 198
df15de21 199 function showInputForm () {
200 global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body,
b8163cc4 201 $passed_body, $color, $use_signature, $signature, $prefix_sig,
202 $editor_size, $attachments, $subject, $newmail,
203 $use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
204 $from_htmladdr_search, $location_of_buttons;
78509c54 205
d51894be 206 $subject = decodeHeader($subject);
2e434774 207 $reply_subj = decodeHeader($reply_subj);
208 $forward_subj = decodeHeader($forward_subj);
01aab860 209
3806fa52 210 if ($use_javascript_addr_book) {
211 echo "\n<SCRIPT LANGUAGE=JavaScript><!--\n";
212 echo "function open_abook() { \n";
213 echo " var nwin = window.open(\"addrbook_popup.php\",\"abookpopup\",";
214 echo "\"width=670,height=300,resizable=yes,scrollbars=yes\");\n";
215 echo " if((!nwin.opener) && (document.windows != null))\n";
216 echo " nwin.opener = document.windows;\n";
217 echo "}\n";
218 echo "// --></SCRIPT>\n\n";
219 }
5100704d 220
b3911477 221 echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST ENCTYPE=\"multipart/form-data\"";
222 do_hook("compose_form");
223 echo ">\n";
966286ae 224 if ($reply_id) {
225 echo "<input type=hidden name=reply_id value=$reply_id>\n";
6e79bfe2 226 }
cf8758c7 227 printf("<INPUT TYPE=hidden NAME=mailbox VALUE=\"%s\">\n", htmlspecialchars($mailbox));
c5d828b3 228 echo "<TABLE WIDTH=\"100%\" ALIGN=center CELLSPACING=0 BORDER=0>\n";
441f2d33 229
230 if ($location_of_buttons == 'top') showComposeButtonRow();
231
df15de21 232 echo " <TR>\n";
c5d828b3 233 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
df15de21 234 echo _("To:");
c5d828b3 235 echo " </TD><TD BGCOLOR=\"$color[4]\">\n";
cf8758c7 236 printf(" <INPUT TYPE=text NAME=\"send_to\" VALUE=\"%s\" SIZE=60><BR>\n",
6e79bfe2 237 htmlspecialchars($send_to));
df15de21 238 echo " </TD>\n";
239 echo " </TR>\n";
240 echo " <TR>\n";
c5d828b3 241 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
aae41ae9 242 echo _("CC:");
c5d828b3 243 echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
cf8758c7 244 printf(" <INPUT TYPE=text NAME=\"send_to_cc\" SIZE=60 VALUE=\"%s\"><BR>\n",
6e79bfe2 245 htmlspecialchars($send_to_cc));
df15de21 246 echo " </TD>\n";
247 echo " </TR>\n";
248 echo " <TR>\n";
c5d828b3 249 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
aae41ae9 250 echo _("BCC:");
761d149e 251 echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
cf8758c7 252 printf(" <INPUT TYPE=text NAME=\"send_to_bcc\" VALUE=\"%s\" SIZE=60><BR>\n",
6e79bfe2 253 htmlspecialchars($send_to_bcc));
3806fa52 254 echo "</TD></TR>\n";
5100704d 255
df15de21 256 echo " <TR>\n";
c5d828b3 257 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
df15de21 258 echo _("Subject:");
761d149e 259 echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
df15de21 260 if ($reply_subj) {
261 $reply_subj = str_replace("\"", "'", $reply_subj);
df15de21 262 $reply_subj = trim($reply_subj);
263 if (substr(strtolower($reply_subj), 0, 3) != "re:")
264 $reply_subj = "Re: $reply_subj";
cf8758c7 265 printf(" <INPUT TYPE=text NAME=subject SIZE=60 VALUE=\"%s\">",
6e79bfe2 266 htmlspecialchars($reply_subj));
df15de21 267 } else if ($forward_subj) {
268 $forward_subj = str_replace("\"", "'", $forward_subj);
df15de21 269 $forward_subj = trim($forward_subj);
270 if ((substr(strtolower($forward_subj), 0, 4) != "fwd:") &&
271 (substr(strtolower($forward_subj), 0, 5) != "[fwd:") &&
272 (substr(strtolower($forward_subj), 0, 6) != "[ fwd:"))
273 $forward_subj = "[Fwd: $forward_subj]";
cf8758c7 274 printf(" <INPUT TYPE=text NAME=subject SIZE=60 VALUE=\"%s\">",
6e79bfe2 275 htmlspecialchars($forward_subj));
df15de21 276 } else {
6e79bfe2 277 printf(" <INPUT TYPE=text NAME=subject SIZE=60 VALUE=\"%s\">",
278 htmlspecialchars($subject));
31f3d7c0 279 }
480feea7 280 echo "</td></tr>\n\n";
281
441f2d33 282 if ($location_of_buttons == 'between') showComposeButtonRow();
4ba45d11 283
e5b23ff2 284 echo " <TR>\n";
c5d828b3 285 echo " <TD BGCOLOR=\"$color[4]\" COLSPAN=2>\n";
cf8758c7 286 echo " &nbsp;&nbsp;<TEXTAREA NAME=body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>";
441f2d33 287 echo htmlspecialchars($body);
6e79bfe2 288 if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) {
b8163cc4 289 if ( $prefix_sig == true )
290 echo "\n\n-- \n" . htmlspecialchars($signature);
291 else
292 echo "\n\n" . htmlspecialchars($signature);
cf8758c7 293 }
294 echo "</TEXTAREA><BR>\n";
e5b23ff2 295 echo " </TD>\n";
296 echo " </TR>\n";
441f2d33 297
298 if ($location_of_buttons == 'bottom')
299 showComposeButtonRow();
300 else {
301 echo " <TR><TD>&nbsp;</TD><TD ALIGN=LEFT><INPUT TYPE=SUBMIT NAME=send VALUE=\""._("Send")."\"></TD></TR>\n";
302 }
e5b23ff2 303
4ba45d11 304 // This code is for attachments
a4fe5de0 305 echo " <tr bgcolor=\"$color[0]\">\n";
306 echo " <TD VALIGN=TOP ALIGN=RIGHT>"._("Attach:");
307 echo " </td><td ALIGN=left>\n";
944eb785 308 echo " <INPUT NAME=\"attachfile\" SIZE=48 TYPE=\"file\">\n";
95de6c91 309 echo " &nbsp;&nbsp;<input type=\"submit\" name=\"attach\"";
310 echo " value=\"" . _("Add") ."\">\n";
469eb37b 311 echo " </td>\n";
469eb37b 312 echo " </tr>\n";
991a059e 313 if (count($attachments) > 0) {
a4fe5de0 314 echo "<tr bgcolor=\"$color[0]\"><td align=right>\n";
e5b23ff2 315 echo "&nbsp;";
a4fe5de0 316 echo "</td><td align=left>";
317 foreach ($attachments as $localname => $remotename) {
4ba45d11 318 echo "<input type=\"checkbox\" name=\"delete[]\" value=\"$localname\">\n";
319 echo "$remotename <input type=\"hidden\" name=\"attachments[$localname]\" value=\"$remotename\"><br>\n";
320 }
321
322 echo "<input type=\"submit\" name=\"do_delete\" value=\""._("Delete selected attachments")."\">\n";
469eb37b 323 echo "</td></tr>";
4ba45d11 324 }
4ba45d11 325 // End of attachment code
326
ffc2ccbc 327 echo "</TABLE>\n";
df15de21 328 echo "</FORM>";
d7d3c4d4 329 do_hook("compose_bottom");
31f3d7c0 330 }
441f2d33 331
332 function showComposeButtonRow() {
2037f4f3 333 global $use_javascript_addr_book;
441f2d33 334 echo " <TR><td>\n </td><td>\n";
335 if ($use_javascript_addr_book) {
336 echo " <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"";
337 echo " <input type=button value=\\\""._("Addresses")."\\\" onclick='javascript:open_abook();'>\");";
338 echo " // --></SCRIPT><NOSCRIPT>\n";
339 echo " <input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
340 echo " </NOSCRIPT>\n";
341 } else {
342 echo " <input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
343 }
344 echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
345
346 do_hook("compose_button_row");
347
348 echo " </TD>\n";
349 echo " </TR>\n\n";
350 }
8467bf00 351
df15de21 352 function showSentForm () {
df15de21 353 echo "<BR><BR><BR><CENTER><B>Message Sent!</B><BR><BR>";
9f2215a1 354 echo "You will be automatically forwarded.<BR>If not, <A HREF=\"right_main.php\">click here</A>";
aae41ae9 355 echo "</CENTER>";
df15de21 356 }
b278172f 357
0ad7dbda 358 function checkInput ($show) {
359 /** I implemented the $show variable because the error messages
360 were getting sent before the page header. So, I check once
361 using $show=false, and then when i'm ready to display the
362 error message, show=true **/
363 global $body, $send_to, $subject, $color;
b278172f 364
99fa2b21 365 if ($send_to == "") {
0ad7dbda 366 if ($show)
367 plain_error_message(_("You have not filled in the \"To:\" field."), $color);
df15de21 368 return false;
b278172f 369 }
df15de21 370 return true;
371 } // function checkInput()
372
3806fa52 373
056ddad7 374 // True if FAILURE
375 function saveAttachedFiles() {
376 global $HTTP_POST_FILES, $attachment_dir, $attachments;
377
378 is_logged_in();
379 $localfilename = GenerateRandomString(32, '', 7);
a4fe5de0 380 while (isset($attachments[$localfilename]))
381 $localfilename = GenerateRandomString(32, '', 7);
056ddad7 382
383 if (!@rename($HTTP_POST_FILES['attachfile']['tmp_name'], $attachment_dir.$localfilename)) {
384 if (!@copy($HTTP_POST_FILES['attachfile']['tmp_name'], $attachment_dir.$localfilename)) {
385 return true;
386 }
387 }
388
23fd3c8e 389 if (!isset($failed) || !$failed) {
056ddad7 390 // Write information about the file
391 $fp = fopen ($attachment_dir.$localfilename.".info", "w");
392 fputs ($fp, $HTTP_POST_FILES['attachfile']['type']."\n".$HTTP_POST_FILES['attachfile']['name']."\n");
393 fclose ($fp);
394
395 $attachments[$localfilename] = $HTTP_POST_FILES['attachfile']['name'];
396 }
397 }
068acdf9 398
399 function SqConvertRussianCharsets(){
400 //
401 // This function is here because Russian Apache is a bastard when it comes to
402 // attachments. The solution is to turn off attachment recoding for multipart
403 // forms and do it manually.
404 // See graf@relhum.org for support.
405 //
406 global $CHARSET, $SOURCE_CHARSET, $send_to, $send_to_cc, $send_to_bcc, $subject, $body;
407 $charset_ary = array("koi8-r" => "k",
408 "windows-1251" => "w",
409 "ibm866" => "a",
410 "ISO-8859-5" => "i");
411 $body = convert_cyr_string($body, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
412 $send_to = convert_cyr_string($send_to, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
413 $send_to_cc = convert_cyr_string($send_to_cc, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
414 $send_to_bcc = convert_cyr_string($send_to_bcc, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
415 $subject = convert_cyr_string($subject, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
416 } // end SqConvertRussianCharsets()
417
418 // Russian Apache sets $CHARSET. See if this is Russian Apache.
419 // If so, check if the source charset (koi8-r) is different from the
420 // one submitted by the browser. If so, recode the parts of the form
421 // to the needed format so SM can proceed and not mangle the cyrillic
422 // input.
423 // See graf@relhum.org for support.
424 //
d0717693 425 if (isset($CHARSET) && $CHARSET != $SOURCE_CHARSET) SqConvertRussianCharsets();
068acdf9 426
23fd3c8e 427 if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
dcb7f454 428 $mailbox = "INBOX";
3806fa52 429
4ba45d11 430 if(isset($send)) {
245a6892 431 if (isset($HTTP_POST_FILES['attachfile']) &&
432 $HTTP_POST_FILES['attachfile']['tmp_name'] &&
78b4216e 433 $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none')
056ddad7 434 $AttachFailure = saveAttachedFiles();
a7ea7540 435 if (checkInput(false) && !isset($AttachFailure)) {
35d520d3 436 $urlMailbox = urlencode (trim($mailbox));
437 if (! isset($reply_id))
438 $reply_id = 0;
ebab5342 439 // Set $default_charset to correspond with the user's selection
440 // of language interface.
441 set_my_charset();
442 sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id);
966286ae 443 header ("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1");
df15de21 444 } else {
01aab860 445 //$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
dcb7f454 446 displayPageHeader($color, $mailbox);
056ddad7 447
448 if ($AttachFailure)
449 plain_error_message(_("Could not move/copy file. File not attached"), $color);
450
0ad7dbda 451 checkInput(true);
452
df15de21 453 showInputForm();
01aab860 454 //sqimap_logout($imapConnection);
7c6cb7ca 455 }
245a6892 456 } else if (isset($html_addr_search_done)) {
3c13b9fb 457 is_logged_in();
dcb7f454 458 displayPageHeader($color, $mailbox);
3806fa52 459
6c7fd6ca 460 for ($i=0; $i < count($send_to_search); $i++) {
461 if ($send_to)
462 $send_to .= ", ";
463 $send_to .= $send_to_search[$i];
464 }
465
466 for ($i=0; $i < count($send_to_cc_search); $i++) {
467 if ($send_to_cc)
468 $send_to_cc .= ", ";
469 $send_to_cc .= $send_to_cc_search[$i];
470 }
471
3806fa52 472 showInputForm();
245a6892 473 } else if (isset($html_addr_search)) {
591d2a88 474 // I am using an include so as to elminiate an extra unnecessary click. If you
475 // can think of a better way, please implement it.
2037f4f3 476 include ("./addrbook_search_html.php");
4ba45d11 477 } else if (isset($attach)) {
056ddad7 478 if (saveAttachedFiles())
22ef7536 479 plain_error_message(_("Could not move/copy file. File not attached"), $color);
21bc0570 480 displayPageHeader($color, $mailbox);
4ba45d11 481 showInputForm();
482 } else if (isset($do_delete)) {
3c13b9fb 483 is_logged_in();
dcb7f454 484 displayPageHeader($color, $mailbox);
fc3348ac 485
fb16d219 486 while (list($lkey, $localname) = each($delete)) {
90555fe7 487 unset ($attachments[$localname]);
c3c37167 488 unlink ($attachment_dir.$localname);
489 unlink ($attachment_dir.$localname.".info");
4ba45d11 490 }
4bfed9f3 491
4ba45d11 492 showInputForm();
493 } else {
991a059e 494 // This handles the default case as well as the error case
495 // (they had the same code) --> if (isset($smtpErrors))
496 $imapConnection = sqimap_login($username, $key, $imapServerAddress,
497 $imapPort, 0);
dcb7f454 498 displayPageHeader($color, $mailbox);
fc3348ac 499
b57c4e63 500 $newmail = true;
991a059e 501 if (isset($forward_id) && $forward_id && isset($ent_num) && $ent_num)
502 getAttachments(0);
5713b4f9 503
1220e677 504 newMail();
4ba45d11 505 showInputForm();
1195c340 506 sqimap_logout($imapConnection);
4ba45d11 507 }
da79853a 508?>