5d8cb68193b10a0c824aeb7fe83c38a322150ba9
[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 include("../src/load_prefs.php");
11
12 if ($passed_body == "") {
13 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
14 displayPageHeader($color, "None");
15 plain_error_message("You have not entered a message body.", $color);
16 exit;
17 } else if ($passed_to == "") {
18 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
19 displayPageHeader($color, "None");
20 plain_error_message("You have not filled in the \"To:\" field.", $color);
21 echo "<FORM action=\"compose_send.php\" METHOD=POST>\n";
22
23 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_subject\" NAME=passed_subject><BR>";
24 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_cc\" NAME=passed_cc><BR>";
25 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_bcc\" NAME=passed_bcc><BR>";
26 echo "<CENTER><FONT FACE=\"Arial,Helvetica\">To: </FONT><INPUT TYPE=TEXT NAME=passed_to SIZE=60><BR>";
27 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_body\" NAME=passed_body><BR>";
28 echo "<INPUT TYPE=SUBMIT VALUE=\"Send\">";
29 echo "</CENTER></FORM>\n";
30
31 exit;
32 } else if ($passed_subject == "") {
33 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
34 displayPageHeader($color, "None");
35 plain_error_message("You have not entered a subject.", $color);
36 echo "<FORM action=\"compose_send.php\" METHOD=POST>\n";
37 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_to\" NAME=passed_to><BR>";
38 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_cc\" NAME=passed_cc><BR>";
39 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_bcc\" NAME=passed_bcc><BR>";
40 echo "<CENTER><FONT FACE=\"Arial,Helvetica\">Subject: </FONT><INPUT TYPE=TEXT NAME=passed_subject SIZE=60 VALUE=\"(no subject)\"><BR>";
41 echo "<INPUT TYPE=HIDDEN VALUE=\"$passed_body\" NAME=passed_body><BR>";
42 echo "<INPUT TYPE=SUBMIT VALUE=\"Send\">";
43 echo "</CENTER></FORM>\n";
44
45 exit;
46 }
47
48 $passed_body = stripslashes($passed_body);
49 $passed_body = stripslashes($passed_body);
50 $passed_to = stripslashes($passed_to);
51 $passed_cc = stripslashes($passed_cc);
52 $passed_bcc = stripslashes($passed_bcc);
53 $passed_subject = stripslashes($passed_subject);
54
55 sendMessage($smtpServerAddress, $smtpPort, $username, $domain, $passed_to, $passed_cc, $passed_bcc, $passed_subject, $passed_body, $version);
56
57 if ($auto_forward == true)
58 echo "<META HTTP-EQUIV=\"REFRESH\" CONTENT=\"0;URL=right_main.php\">";
59 echo "<BODY TEXT=\"$color[8]\" BGCOLOR=\"$color[4]\" LINK=\"$color[7]\" VLINK=\"$color[7]\" ALINK=\"$color[7]\">\n";
60
61 displayPageHeader($color, "None");
62 echo "<FONT FACE=\"Arial,Helvetica\">";
63 echo "<BR><BR><BR><CENTER><B>Message Sent!</B><BR><BR>";
64 echo "You will be automatically forwarded.<BR>If not, <A HREF=\"right_main.php\">click here</A>";
65 echo "</CENTER></FONT>";
66 ?>
67 </BODY></HTML>