* Added the !== false bit to the strstr so that even if the first three
[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);
511f7816 175 while (isset($attachments[$localfilename]))
176 $localfilename = GenerateRandomString(32, '', 7);
3b5b889f 177
991a059e 178 // Write File Info
179 $fp = fopen ($attachment_dir.$localfilename.".info", "w");
180 fputs ($fp, strtolower($message->header->type0)."/".
181 strtolower($message->header->type1)."\n".$filename."\n");
182 fclose ($fp);
183
184 // Write Attachment to file
185 $fp = fopen ($attachment_dir.$localfilename, "w");
186 fputs ($fp, decodeBody(mime_fetch_body($imapConnection,
187 $forward_id, $message->header->entity_id),
188 $message->header->encoding));
189 fclose ($fp);
5713b4f9 190
991a059e 191 $attachments[$localfilename] = $filename;
192 }
5713b4f9 193 } else {
991a059e 194 for ($i = 0; $i < count($message->entities); $i++) {
5713b4f9 195 getAttachments($message->entities[$i]);
991a059e 196 }
5713b4f9 197 }
198 return;
991a059e 199 }
5713b4f9 200
df15de21 201 function showInputForm () {
202 global $send_to, $send_to_cc, $reply_subj, $forward_subj, $body,
b8163cc4 203 $passed_body, $color, $use_signature, $signature, $prefix_sig,
204 $editor_size, $attachments, $subject, $newmail,
205 $use_javascript_addr_book, $send_to_bcc, $reply_id, $mailbox,
206 $from_htmladdr_search, $location_of_buttons;
78509c54 207
d51894be 208 $subject = decodeHeader($subject);
2e434774 209 $reply_subj = decodeHeader($reply_subj);
210 $forward_subj = decodeHeader($forward_subj);
01aab860 211
3806fa52 212 if ($use_javascript_addr_book) {
213 echo "\n<SCRIPT LANGUAGE=JavaScript><!--\n";
214 echo "function open_abook() { \n";
215 echo " var nwin = window.open(\"addrbook_popup.php\",\"abookpopup\",";
216 echo "\"width=670,height=300,resizable=yes,scrollbars=yes\");\n";
217 echo " if((!nwin.opener) && (document.windows != null))\n";
218 echo " nwin.opener = document.windows;\n";
219 echo "}\n";
220 echo "// --></SCRIPT>\n\n";
221 }
5100704d 222
b3911477 223 echo "\n<FORM name=compose action=\"compose.php\" METHOD=POST ENCTYPE=\"multipart/form-data\"";
224 do_hook("compose_form");
225 echo ">\n";
966286ae 226 if ($reply_id) {
227 echo "<input type=hidden name=reply_id value=$reply_id>\n";
6e79bfe2 228 }
cf8758c7 229 printf("<INPUT TYPE=hidden NAME=mailbox VALUE=\"%s\">\n", htmlspecialchars($mailbox));
c5d828b3 230 echo "<TABLE WIDTH=\"100%\" ALIGN=center CELLSPACING=0 BORDER=0>\n";
441f2d33 231
232 if ($location_of_buttons == 'top') showComposeButtonRow();
233
df15de21 234 echo " <TR>\n";
c5d828b3 235 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
df15de21 236 echo _("To:");
c5d828b3 237 echo " </TD><TD BGCOLOR=\"$color[4]\">\n";
cf8758c7 238 printf(" <INPUT TYPE=text NAME=\"send_to\" VALUE=\"%s\" SIZE=60><BR>\n",
6e79bfe2 239 htmlspecialchars($send_to));
df15de21 240 echo " </TD>\n";
241 echo " </TR>\n";
242 echo " <TR>\n";
c5d828b3 243 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
aae41ae9 244 echo _("CC:");
c5d828b3 245 echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
cf8758c7 246 printf(" <INPUT TYPE=text NAME=\"send_to_cc\" SIZE=60 VALUE=\"%s\"><BR>\n",
6e79bfe2 247 htmlspecialchars($send_to_cc));
df15de21 248 echo " </TD>\n";
249 echo " </TR>\n";
250 echo " <TR>\n";
c5d828b3 251 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
aae41ae9 252 echo _("BCC:");
761d149e 253 echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
cf8758c7 254 printf(" <INPUT TYPE=text NAME=\"send_to_bcc\" VALUE=\"%s\" SIZE=60><BR>\n",
6e79bfe2 255 htmlspecialchars($send_to_bcc));
3806fa52 256 echo "</TD></TR>\n";
5100704d 257
df15de21 258 echo " <TR>\n";
c5d828b3 259 echo " <TD BGCOLOR=\"$color[4]\" ALIGN=RIGHT>\n";
df15de21 260 echo _("Subject:");
761d149e 261 echo " </TD><TD BGCOLOR=\"$color[4]\" ALIGN=LEFT>\n";
df15de21 262 if ($reply_subj) {
263 $reply_subj = str_replace("\"", "'", $reply_subj);
df15de21 264 $reply_subj = trim($reply_subj);
265 if (substr(strtolower($reply_subj), 0, 3) != "re:")
266 $reply_subj = "Re: $reply_subj";
cf8758c7 267 printf(" <INPUT TYPE=text NAME=subject SIZE=60 VALUE=\"%s\">",
6e79bfe2 268 htmlspecialchars($reply_subj));
df15de21 269 } else if ($forward_subj) {
270 $forward_subj = str_replace("\"", "'", $forward_subj);
df15de21 271 $forward_subj = trim($forward_subj);
272 if ((substr(strtolower($forward_subj), 0, 4) != "fwd:") &&
273 (substr(strtolower($forward_subj), 0, 5) != "[fwd:") &&
274 (substr(strtolower($forward_subj), 0, 6) != "[ fwd:"))
275 $forward_subj = "[Fwd: $forward_subj]";
cf8758c7 276 printf(" <INPUT TYPE=text NAME=subject SIZE=60 VALUE=\"%s\">",
6e79bfe2 277 htmlspecialchars($forward_subj));
df15de21 278 } else {
6e79bfe2 279 printf(" <INPUT TYPE=text NAME=subject SIZE=60 VALUE=\"%s\">",
280 htmlspecialchars($subject));
31f3d7c0 281 }
480feea7 282 echo "</td></tr>\n\n";
283
441f2d33 284 if ($location_of_buttons == 'between') showComposeButtonRow();
4ba45d11 285
e5b23ff2 286 echo " <TR>\n";
c5d828b3 287 echo " <TD BGCOLOR=\"$color[4]\" COLSPAN=2>\n";
cf8758c7 288 echo " &nbsp;&nbsp;<TEXTAREA NAME=body ROWS=20 COLS=\"$editor_size\" WRAP=HARD>";
441f2d33 289 echo htmlspecialchars($body);
6e79bfe2 290 if ($use_signature == true && $newmail == true && !isset($from_htmladdr_search)) {
b8163cc4 291 if ( $prefix_sig == true )
292 echo "\n\n-- \n" . htmlspecialchars($signature);
293 else
294 echo "\n\n" . htmlspecialchars($signature);
cf8758c7 295 }
296 echo "</TEXTAREA><BR>\n";
e5b23ff2 297 echo " </TD>\n";
298 echo " </TR>\n";
441f2d33 299
300 if ($location_of_buttons == 'bottom')
301 showComposeButtonRow();
302 else {
303 echo " <TR><TD>&nbsp;</TD><TD ALIGN=LEFT><INPUT TYPE=SUBMIT NAME=send VALUE=\""._("Send")."\"></TD></TR>\n";
304 }
e5b23ff2 305
4ba45d11 306 // This code is for attachments
a4fe5de0 307 echo " <tr bgcolor=\"$color[0]\">\n";
308 echo " <TD VALIGN=TOP ALIGN=RIGHT>"._("Attach:");
309 echo " </td><td ALIGN=left>\n";
944eb785 310 echo " <INPUT NAME=\"attachfile\" SIZE=48 TYPE=\"file\">\n";
95de6c91 311 echo " &nbsp;&nbsp;<input type=\"submit\" name=\"attach\"";
312 echo " value=\"" . _("Add") ."\">\n";
469eb37b 313 echo " </td>\n";
469eb37b 314 echo " </tr>\n";
991a059e 315 if (count($attachments) > 0) {
a4fe5de0 316 echo "<tr bgcolor=\"$color[0]\"><td align=right>\n";
e5b23ff2 317 echo "&nbsp;";
a4fe5de0 318 echo "</td><td align=left>";
319 foreach ($attachments as $localname => $remotename) {
4ba45d11 320 echo "<input type=\"checkbox\" name=\"delete[]\" value=\"$localname\">\n";
321 echo "$remotename <input type=\"hidden\" name=\"attachments[$localname]\" value=\"$remotename\"><br>\n";
322 }
323
324 echo "<input type=\"submit\" name=\"do_delete\" value=\""._("Delete selected attachments")."\">\n";
469eb37b 325 echo "</td></tr>";
4ba45d11 326 }
4ba45d11 327 // End of attachment code
328
ffc2ccbc 329 echo "</TABLE>\n";
df15de21 330 echo "</FORM>";
d7d3c4d4 331 do_hook("compose_bottom");
31f3d7c0 332 }
441f2d33 333
334 function showComposeButtonRow() {
2037f4f3 335 global $use_javascript_addr_book;
441f2d33 336 echo " <TR><td>\n </td><td>\n";
337 if ($use_javascript_addr_book) {
338 echo " <SCRIPT LANGUAGE=JavaScript><!--\n document.write(\"";
339 echo " <input type=button value=\\\""._("Addresses")."\\\" onclick='javascript:open_abook();'>\");";
340 echo " // --></SCRIPT><NOSCRIPT>\n";
341 echo " <input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
342 echo " </NOSCRIPT>\n";
343 } else {
344 echo " <input type=submit name=\"html_addr_search\" value=\""._("Addresses")."\">";
345 }
346 echo "\n <INPUT TYPE=SUBMIT NAME=send VALUE=\"". _("Send") . "\">\n";
347
348 do_hook("compose_button_row");
349
350 echo " </TD>\n";
351 echo " </TR>\n\n";
352 }
8467bf00 353
df15de21 354 function showSentForm () {
df15de21 355 echo "<BR><BR><BR><CENTER><B>Message Sent!</B><BR><BR>";
9f2215a1 356 echo "You will be automatically forwarded.<BR>If not, <A HREF=\"right_main.php\">click here</A>";
aae41ae9 357 echo "</CENTER>";
df15de21 358 }
b278172f 359
0ad7dbda 360 function checkInput ($show) {
361 /** I implemented the $show variable because the error messages
362 were getting sent before the page header. So, I check once
363 using $show=false, and then when i'm ready to display the
364 error message, show=true **/
365 global $body, $send_to, $subject, $color;
b278172f 366
99fa2b21 367 if ($send_to == "") {
0ad7dbda 368 if ($show)
369 plain_error_message(_("You have not filled in the \"To:\" field."), $color);
df15de21 370 return false;
b278172f 371 }
df15de21 372 return true;
373 } // function checkInput()
374
3806fa52 375
056ddad7 376 // True if FAILURE
377 function saveAttachedFiles() {
378 global $HTTP_POST_FILES, $attachment_dir, $attachments;
379
380 is_logged_in();
381 $localfilename = GenerateRandomString(32, '', 7);
a4fe5de0 382 while (isset($attachments[$localfilename]))
383 $localfilename = GenerateRandomString(32, '', 7);
056ddad7 384
385 if (!@rename($HTTP_POST_FILES['attachfile']['tmp_name'], $attachment_dir.$localfilename)) {
386 if (!@copy($HTTP_POST_FILES['attachfile']['tmp_name'], $attachment_dir.$localfilename)) {
387 return true;
388 }
389 }
390
23fd3c8e 391 if (!isset($failed) || !$failed) {
056ddad7 392 // Write information about the file
393 $fp = fopen ($attachment_dir.$localfilename.".info", "w");
394 fputs ($fp, $HTTP_POST_FILES['attachfile']['type']."\n".$HTTP_POST_FILES['attachfile']['name']."\n");
395 fclose ($fp);
396
397 $attachments[$localfilename] = $HTTP_POST_FILES['attachfile']['name'];
398 }
399 }
068acdf9 400
401 function SqConvertRussianCharsets(){
402 //
403 // This function is here because Russian Apache is a bastard when it comes to
404 // attachments. The solution is to turn off attachment recoding for multipart
405 // forms and do it manually.
406 // See graf@relhum.org for support.
407 //
408 global $CHARSET, $SOURCE_CHARSET, $send_to, $send_to_cc, $send_to_bcc, $subject, $body;
409 $charset_ary = array("koi8-r" => "k",
410 "windows-1251" => "w",
411 "ibm866" => "a",
412 "ISO-8859-5" => "i");
413 $body = convert_cyr_string($body, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
414 $send_to = convert_cyr_string($send_to, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
415 $send_to_cc = convert_cyr_string($send_to_cc, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
416 $send_to_bcc = convert_cyr_string($send_to_bcc, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
417 $subject = convert_cyr_string($subject, $charset_ary[$CHARSET], $charset_ary[$SOURCE_CHARSET]);
418 } // end SqConvertRussianCharsets()
419
420 // Russian Apache sets $CHARSET. See if this is Russian Apache.
421 // If so, check if the source charset (koi8-r) is different from the
422 // one submitted by the browser. If so, recode the parts of the form
423 // to the needed format so SM can proceed and not mangle the cyrillic
424 // input.
425 // See graf@relhum.org for support.
426 //
d0717693 427 if (isset($CHARSET) && $CHARSET != $SOURCE_CHARSET) SqConvertRussianCharsets();
068acdf9 428
23fd3c8e 429 if (!isset($mailbox) || $mailbox == "" || ($mailbox == "None"))
dcb7f454 430 $mailbox = "INBOX";
3806fa52 431
4ba45d11 432 if(isset($send)) {
245a6892 433 if (isset($HTTP_POST_FILES['attachfile']) &&
434 $HTTP_POST_FILES['attachfile']['tmp_name'] &&
78b4216e 435 $HTTP_POST_FILES['attachfile']['tmp_name'] != 'none')
056ddad7 436 $AttachFailure = saveAttachedFiles();
a7ea7540 437 if (checkInput(false) && !isset($AttachFailure)) {
35d520d3 438 $urlMailbox = urlencode (trim($mailbox));
439 if (! isset($reply_id))
440 $reply_id = 0;
ebab5342 441 // Set $default_charset to correspond with the user's selection
442 // of language interface.
443 set_my_charset();
444 sendMessage($send_to, $send_to_cc, $send_to_bcc, $subject, $body, $reply_id);
966286ae 445 header ("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1");
df15de21 446 } else {
01aab860 447 //$imapConnection = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0);
dcb7f454 448 displayPageHeader($color, $mailbox);
056ddad7 449
450 if ($AttachFailure)
451 plain_error_message(_("Could not move/copy file. File not attached"), $color);
452
0ad7dbda 453 checkInput(true);
454
df15de21 455 showInputForm();
01aab860 456 //sqimap_logout($imapConnection);
7c6cb7ca 457 }
245a6892 458 } else if (isset($html_addr_search_done)) {
3c13b9fb 459 is_logged_in();
dcb7f454 460 displayPageHeader($color, $mailbox);
3806fa52 461
6c7fd6ca 462 for ($i=0; $i < count($send_to_search); $i++) {
463 if ($send_to)
464 $send_to .= ", ";
465 $send_to .= $send_to_search[$i];
466 }
467
468 for ($i=0; $i < count($send_to_cc_search); $i++) {
469 if ($send_to_cc)
470 $send_to_cc .= ", ";
471 $send_to_cc .= $send_to_cc_search[$i];
472 }
473
3806fa52 474 showInputForm();
245a6892 475 } else if (isset($html_addr_search)) {
591d2a88 476 // I am using an include so as to elminiate an extra unnecessary click. If you
477 // can think of a better way, please implement it.
2037f4f3 478 include ("./addrbook_search_html.php");
4ba45d11 479 } else if (isset($attach)) {
056ddad7 480 if (saveAttachedFiles())
22ef7536 481 plain_error_message(_("Could not move/copy file. File not attached"), $color);
21bc0570 482 displayPageHeader($color, $mailbox);
4ba45d11 483 showInputForm();
484 } else if (isset($do_delete)) {
3c13b9fb 485 is_logged_in();
dcb7f454 486 displayPageHeader($color, $mailbox);
fc3348ac 487
fb16d219 488 while (list($lkey, $localname) = each($delete)) {
90555fe7 489 unset ($attachments[$localname]);
c3c37167 490 unlink ($attachment_dir.$localname);
491 unlink ($attachment_dir.$localname.".info");
4ba45d11 492 }
4bfed9f3 493
4ba45d11 494 showInputForm();
495 } else {
991a059e 496 // This handles the default case as well as the error case
497 // (they had the same code) --> if (isset($smtpErrors))
498 $imapConnection = sqimap_login($username, $key, $imapServerAddress,
499 $imapPort, 0);
dcb7f454 500 displayPageHeader($color, $mailbox);
fc3348ac 501
b57c4e63 502 $newmail = true;
991a059e 503 if (isset($forward_id) && $forward_id && isset($ent_num) && $ent_num)
504 getAttachments(0);
5713b4f9 505
1220e677 506 newMail();
4ba45d11 507 showInputForm();
1195c340 508 sqimap_logout($imapConnection);
4ba45d11 509 }
da79853a 510?>