PluginDir = "./inc/"; if ($phpmailer_sendmail != "") { $mail->Sendmail = $phpmailer_sendmail; } if ($phpmailer_timeout != 0) { $mail->Timeout = $phpmailer_timeout; } $ARTo = $UM->get_names(stripslashes($to)); $ARCc = $UM->get_names(stripslashes($cc)); $ARBcc = $UM->get_names(stripslashes($bcc)); if((count($ARTo)+count($ARCc)+count($ARBcc)) > 0) { // set lang for error messages, english for now $mail->SetLanguage("en","langs/"); // for password authenticated servers $mail->SMTPAuth = $use_password_for_smtp; $mail->Username = $sess["user"]; $mail->Password = $sess["pass"]; // if using the advanced editor if($is_html == "true") { $mail->IsHTML(1); if($footer != "") $body .= preg_replace("/(\r?\n)/","
\\1",$footer); } elseif ($footer != "") $body .= $footer; $mail->CharSet = $default_char_set; $mail->Hostname = getenv("SERVER_ADDR"); $mail->From = ($allow_modified_from && !empty($prefs["reply-to"]))?$prefs["reply-to"]:$sess["email"]; $mail->FromName = $UM->mime_encode_headers($prefs["real-name"]); $mail->AddReplyTo($prefs["reply-to"], $UM->mime_encode_headers($prefs["real-name"])); $mail->Host = $smtp_server; $mail->WordWrap = 76; $mail->Priority = $priority; $mail->SMTPDebug = false; if(count($ARTo) != 0) { for($i=0;$iAddAddress($email,$UM->mime_encode_headers($name)); else $mail->AddAddress($email); } } if(count($ARCc) != 0) { for($i=0;$iAddCC($email,$UM->mime_encode_headers($name)); else $mail->AddCC($email); } } if(count($ARBcc) != 0) { for($i=0;$iAddBCC($email,$UM->mime_encode_headers($name)); else $mail->AddBCC($email); } } if(array_key_exists("attachments",$sess)) { $attachs = $sess["attachments"]; for($i=0;$iAddAttachment($attachs[$i]["localname"], $attachs[$i]["name"], "base64", $attachs[$i]["type"]); } } } $mail->Subject = $UM->mime_encode_headers(stripslashes($subject)); $mail->Body = stripslashes($body); $mail->Mailer = $mailer_type; if(($mail->Send()) === false) { $smarty->assign("umMailSent",false); $smarty->assign("umErrorMessage",$mail->ErrorInfo); } else { $smarty->assign("umMailSent",true); if(array_key_exists("attachments",$sess)) { unset($sess["attachments"]); reset($sess); $SS->Save($sess); } if($prefs["save-to-sent"]) { if(!$UM->mail_connect()) { redirect_and_exit("error.php?err=1"); } if(!$UM->mail_auth(false)) { redirect_and_exit("badlogin.php?error=".urlencode($UM->mail_error_msg)); } $UM->mail_save_message("sent",$mail->FormattedMail,"\\SEEN"); unset($sess["headers"][base64_encode("sent")]); $UM->mail_disconnect(); $SS->Save($sess); } } } else die(""); $jssource = " "; $smarty->assign("umJS",$jssource); $smarty->display("$selected_theme/newmsg-result.htm"); }else { $priority_level = (!isset($priority) || empty($priority)) ? 3 : $priority ; $uagent = $_SERVER["HTTP_USER_AGENT"]; $isMac = ereg("Mac",$uagent); $isOpera = ereg("Opera",$uagent); $uagent = explode("; ",$uagent); $uagent = explode(" ",$uagent[1]); $bname = strtoupper($uagent[0]); $bvers = $uagent[1]; if(!isset($textmode)) $textmode = null; $show_advanced = ((!$textmode) && ($prefs["editor-mode"] != "text")) ? 1 : 0 ; $js_advanced = ($show_advanced) ? "true" : "false" ; $signature = $prefs["signature"]; if($show_advanced) $signature = nl2br($signature); $add_sig = $prefs["add-sig"]; $umAddSig = ($add_sig) ? 1 : 0 ; $forms = " "; $jssource = ""; if ($show_advanced) { $jssource = " "; } $jssource .= " "; $smarty->assign("umPriority",$priority_level); $smarty->assign("umAddSignature",$umAddSig); $smarty->assign("umForms",$forms); $smarty->assign("umJS",$jssource); if(!isset($body)) $body = null; $body = stripslashes($body); if(isset($rtype)) { $mail_info = $sess["headers"][base64_encode(strtolower($folder))][$ix]; if(!eregi("\\ANSWERED",$mail_info["flags"])) { if(!$UM->mail_connect()) { die(""); } if(!$UM->mail_auth()) { die(""); } if($UM->mail_set_flag($mail_info,"\\ANSWERED","+")) { $sess["headers"][base64_encode(strtolower($folder))][$ix] = $mail_info; $SS->Save($sess); } $UM->mail_disconnect(); } $filename = $mail_info["localname"]; if(!file_exists($filename)) die(""); $result = $UM->_read_file($filename); $UM->displayimages = $prefs["display-images"]; $UM->sanitize = ($sanitize_html || !$allow_scripts); $email = $UM->Decode($result); $result = $UM->fetch_structure($result); $tmpbody = $email["body"]; $subject = $mail_info["subject"]; $ARReplyTo = $email["reply-to"]; $ARFrom = $email["from"]; $useremail = $sess["email"]; // from if($ARReplyTo[0]["mail"] != "") { $name = $ARReplyTo[0]["name"]; $thismail = $ARReplyTo[0]["mail"]; } else { $name = $ARFrom[0]["name"]; $thismail = $ARFrom[0]["mail"]; } $fromreply = "\"$name\" <$thismail>"; // To $ARTo = $email["to"]; for($i=0;$i"; else $toreply = "\"$name\" <$thismail>"; } // CC $ARCC = $email["cc"]; for($i=0;$i"; else $ccreply = "\"$name\" <$thismail>"; } function clear_names($strMail) { global $UM; $strMail = $UM->get_names($strMail); for($i=0;$i":$thismail["mail"]; if($thismail["mail"] != "" && strpos($result,$thismail["mail"]) === false) { if($result != "") $result .= ", ".$thisline; else $result = $thisline; } } return $result; } $allreply = clear_names($fromreply.", ".$toreply); $ccreply = clear_names($ccreply); $fromreply = clear_names($fromreply); $msgsubject = $email["subject"]; $fromreply_quote = $fromreply; $toreply_quote = $toreply; $ccreply_quote = $ccreply; $msgsubject_quote = $msgsubject; if($show_advanced) { $fromreply_quote = htmlspecialchars($fromreply_quote); $toreply_quote = htmlspecialchars($toreply_quote); $ccreply_quote = htmlspecialchars($ccreply_quote); $msgsubject_quote = htmlspecialchars($msgsubject_quote); $linebreak = "
"; } else { $tmpbody = strip_tags($tmpbody); $quote_string = "> "; $tmpbody = $quote_string.ereg_replace("\n","\n$quote_string",$tmpbody); } $body = " $reply_delimiter$linebreak $reply_from_hea ".ereg_replace("(\")","",$fromreply_quote)."$linebreak $reply_to_hea ".ereg_replace("(\")","",$toreply_quote); if(!empty($ccreply)) { $body .= "$linebreak $reply_cc_hea ".ereg_replace("(\")","",$ccreply_quote); } $body .= "$linebreak $reply_subject_hea ".$msgsubject_quote."$linebreak $reply_date_hea ".@strftime($date_format,$email["date"])."$linebreak $linebreak $tmpbody"; if($show_advanced) { $body = "
$body
"; } switch($rtype) { case "reply": if(!eregi("^$reply_prefix",trim($subject))) $subject = "$reply_prefix $subject"; $to = $fromreply; break; case "replyall": if(!eregi("^$reply_prefix",trim($subject))) $subject = "$reply_prefix $subject"; $to = $allreply; $cc = $ccreply; break; case "forward": if(!eregi("^$forward_prefix",trim($subject))) $subject = "$forward_prefix $subject"; if(count($email["attachments"]) > 0) { for($i = 0; $i < count($email["attachments"]); $i++) { $current = $email["attachments"][$i]; $ind = count($sess["attachments"]); $sess["attachments"][$ind]["localname"] = $current["filename"]; $sess["attachments"][$ind]["name"] = $current["name"]; $sess["attachments"][$ind]["type"] = $current["content-type"]; $sess["attachments"][$ind]["size"] = $current["size"]; } $SS->Save($sess); } break; } if($add_sig && !empty($signature)) if($show_advanced) $body = "

--
$signature

$body"; else $body = "\r\n\r\n--\r\n$signature\r\n\r\n$body"; } else if($add_sig && !empty($signature) && empty($body)) if($show_advanced) $body = "

--
$signature

$body"; else $body = "\r\n\r\n--\r\n$signature\r\n\r\n$body"; $haveSig = empty($signature) ? 0 : 1 ; $smarty->assign("umHaveSignature",$haveSig); if(!isset($to)) $to = null; if(!isset($cc)) $cc = null; if(!isset($bcc)) $bcc = null; if(!isset($subject)) $subject = null; $strto = (isset($nameto) && eregi("([-a-z0-9_$+.]+@[-a-z0-9_.]+[-a-z0-9_])",$mailto))? "\" /> ":""; $strcc = ""; $strbcc = ""; $strsubject = ""; if(array_key_exists("attachments", $sess) && count($attachs = $sess["attachments"]) > 0) { $smarty->assign("umHaveAttachs",1); $attachlist = Array(); for($i=0;$iassign("umAttachList",$attachlist); } if(!$show_advanced) $body = stripslashes($body); if(!isset($txtarea)) $txtarea = null; /* * Force the below to 0. We do not want to * enable the old HTML editor even when using * HTML Email. */ // $umAdvEdit = ($show_advanced) ? 1 : 0 ; $umAdvEdit = 0 ; $smarty->assign("umBody",$body); $smarty->assign("umTo",$strto); $smarty->assign("umCc",$strcc); $smarty->assign("umBcc",$strbcc); $smarty->assign("umSubject",$strsubject); $smarty->assign("umTextEditor",$txtarea); $smarty->assign("umAdvancedEditor",$umAdvEdit); $smarty->display("$selected_theme/newmsg.htm"); } ?>