Added some error correction on compose_send.php
[squirrelmail.git] / src / compose_send.php
1 <HTML>
2 <?
3 include("../config/config.php");
4 include("../functions/strings.php");
5 include("../functions/page_header.php");
6 include("../functions/mailbox.php");
7 include("../functions/smtp.php");
8 include("../functions/display_messages.php");
9
10 if ($passed_to == "") {
11 echo "<BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">";
12 displayPageHeader("None");
13 plain_error_message("You have not filled in the \"To:\" field.");
14 echo "<FORM action=\"compose_send.php\" METHOD=POST>\n";
15
16 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_subject\" NAME=passed_subject><BR>";
17 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_cc\" NAME=passed_cc><BR>";
18 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_bcc\" NAME=passed_bcc><BR>";
19 echo "<CENTER><FONT FACE=\"Arial,Helvetica\">To: </FONT><INPUT TYPE=TEXT NAME=passed_to SIZE=60><BR>";
20 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_body\" NAME=passed_body><BR>";
21 echo "<INPUT TYPE=SUBMIT VALUE=\"Send\">";
22 echo "</CENTER></FORM>\n";
23
24 exit;
25
26 echo "<BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">";
27 displayPageHeader("None");
28 plain_error_message("Message NOT sent<BR><BR>You have not entered anything into the To: field.<BR>Press the BACK button on your browser");
29 exit;
30 } else if ($passed_subject == "") {
31 echo "<BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">";
32 displayPageHeader("None");
33 plain_error_message("You have not entered a subject.");
34 echo "<FORM action=\"compose_send.php\" METHOD=POST>\n";
35 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_cc\" NAME=passed_cc><BR>";
36 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_bcc\" NAME=passed_bcc><BR>";
37 echo "<CENTER><FONT FACE=\"Arial,Helvetica\">Subject: </FONT><INPUT TYPE=TEXT NAME=passed_subject SIZE=60 VALUE=\"(no subject)\"><BR>";
38 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_body\" NAME=passed_body><BR>";
39 echo "<INPUT TYPE=SUBMIT VALUE=\"Send\">";
40 echo "</CENTER></FORM>\n";
41
42 exit;
43 }
44
45 sendMessage($smtpServerAddress, $smtpPort, $username, $domain, $passed_to, $passed_cc, $passed_bcc, $passed_subject, $passed_body, $version);
46
47 echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0;URL=right_main.php\">";
48 echo "<BODY TEXT=\"#000000\" BGCOLOR=\"#FFFFFF\" LINK=\"#0000EE\" VLINK=\"#0000EE\" ALINK=\"#0000EE\">";
49
50 displayPageHeader("None");
51 echo "<FONT FACE=\"Arial,Helvetica\">";
52 echo "<BR><BR><BR><CENTER><B>Message Sent!</B><BR><BR>";
53 echo "You will be automatically forwarded.<BR>If not, <A HREF=\"right_main.php\">click here</A>";
54 echo "</CENTER></FONT>";
55 ?>
56 </BODY></HTML>