+ // Set $default_charset to correspond with the user's selection
+ // of language interface.
+ set_my_charset();
+
+ // This is to change all newlines to \n
+ // We'll change them to \r\n later (in the sendMessage function)
+ $body = str_replace("\r\n", "\n", $body);
+ $body = str_replace("\r", "\n", $body);
+
+ // Rewrap $body so that no line is bigger than $editor_size
+ // This should only really kick in the sqWordWrap function
+ // if the browser doesn't support "HARD" as the wrap type
+ // Or, in Opera's case, something goes wrong.
+ $body = explode("\n", $body);
+ $newBody = '';
+ foreach ($body as $line) {
+ if( $line <> '-- ' )
+ $line = rtrim($line);
+ if (strlen($line) <= $editor_size + 1)
+ $newBody .= $line . "\n";
+ else {
+ sqWordWrap($line, $editor_size) . "\n";
+ $newBody .= $line;
+ }
+ }
+ $body = $newBody;
+
+ do_hook("compose_send");
+
+ if (! isset($mailprio))
+ $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
+ $subject, $body, $reply_id);
+ else
+ $Result = sendMessage($send_to, $send_to_cc, $send_to_bcc,
+ $subject, $body, $reply_id, $mailprio);
+ if (! $Result) {
+ showInputForm();
+ exit();
+ }
+ if ( isset($delete_draft)) {
+ Header("Location: delete_message.php?mailbox=$draft_folder&message=$delete_draft&sort=$sort&startMessage=1");
+ exit();
+ }
+
+ Header("Location: right_main.php?mailbox=$urlMailbox&sort=$sort&startMessage=1");