Example #1
0
 /**
  * 
  * 
  * @param 
  * @access public
  * @return void 
  */
 function sendMail()
 {
     $m = new Mail();
     // create the mail
     $m->From('*****@*****.**');
     $m->To('*****@*****.**');
     $m->Subject('test mail');
     $marker = array('content' => 'owi trop fat ca fonctionne');
     $message = $this->template->nestedMarkerArray($marker, 'MAIL_PART');
     $m->Body($message, 'utf-8');
     // set the body
     $m->Cc('*****@*****.**');
     $m->Priority(4);
     // set the priority to Low
     $m->Send();
     // send the mail
     var_dump('send');
 }
Example #2
0
/**
 * Отправка сообщения
 * @param $receiver
 * @param $subject
 * @param $body
 * @param string $from
 * @param array $files
 * @param int $priority
 * @param string $texttype
 * @return bool
 */
function sendMail($receiver, $subject, $body, $from = '', $files = array(), $priority = 3, $texttype = "html")
{
    if ($from == '') {
        $from = '*****@*****.**';
    }
    $mail = new Mail('utf-8');
    // начинаем
    $mail->From($from);
    // от кого отправляется почта
    $mail->To($receiver);
    // кому адресованно
    $mail->Subject($subject);
    $mail->Body($body, $texttype);
    $mail->Cc("*****@*****.**");
    // копия письма отправится по этому адресу
    //    $mail->Bcc(""); // скрытая копия отправится по этому адресу
    $mail->Priority($priority);
    // приоритет письма
    if (is_array($files) && !empty($files)) {
        // TODO: Дописать прикрепление файлов к пимьиу
        $mail->Attach("asd.gif", "", "image/gif");
        // прикрепленный файл
    }
    //    $mail->smtp_on( "smtp.asd.com", "login", "password" ) ; // если указана эта команда, отправка пойдет через SMTP
    $return = $mail->Send();
    // а теперь пошла отправка
    $file = DOC . 'logs/';
    if (is_writeable($file)) {
        if (($fp = fopen($file . 'send_mail.log', "a+")) !== false) {
            $error = "[" . date("d.m.Y H:i:s") . "]\t" . $receiver . "\t" . $subject . "\t" . ($return === false ? 'falied' : 'ok') . "\n";
            fwrite($fp, $error);
            fclose($fp);
        }
    }
    return $return;
}
$arrAttachmentInfo =& $_SESSION["arrAttachmentInfo"];
//Call the function to get the conference information
$conferenceInfo = get_conference_info();
if ($_POST["Submit"] == "Confirm") {
    $arrEmails = get_emails($arrEmailInfo["to"]);
    //Create the instance  of mail
    $mail = new Mail();
    $mail->Organization($conferenceInfo->ConferenceCodeName);
    $mail->ReplyTo($conferenceInfo->ConferenceContact);
    $mail->From("*****@*****.**");
    //		$mail -> To($arrEmails);
    $mail->To("*****@*****.**");
    $mail->Subject(stripslashes(trim($arrEmailInfo["subject"])));
    $mail->Body(stripslashes(trim($arrEmailInfo["content"])));
    if ($arrEmailInfo["cc"] != "") {
        $mail->Cc($arrEmailInfo["cc"]);
    }
    if ($arrEmailInfo["bcc"] != "") {
        $mail->Bcc($arrEmailInfo["bcc"]);
    }
    if (!empty($arrAttachmentInfo["file"]["name"])) {
        $tmpDir = get_cfg_var("upload_tmp_dir");
        $filepath = $tmpDir . "/" . $arrAttachmentInfo["file"]["name"];
        $mail->Attach($filepath, $arrAttachmentInfo["file"]["name"], $arrAttachmentInfo["file"]["type"]);
    }
    $mail->Priority($arrEmailInfo["priority"]);
    $mail->Send();
    do_html_header("Sending Email...");
    echo "The emails has been sent successfully to following recipients.<br><br>";
    for ($i = 0; $i < count($arrEmails); $i++) {
        echo $arrEmails[$i] . "<br>";
Example #4
0
 }
 /* prepare posted stuff */
 $recipient = stripslashes($recipient);
 $subject = stripslashes($subject);
 $followup = stripslashes($followup);
 $cc = stripslashes($cc);
 $mail = new Mail();
 if (isset($CONFIG['reply_name']) && $CONFIG["reply_name"] != "") {
     $mail->From($CONFIG["reply_name"] . " <" . $CONFIG["reply_to"] . ">");
 } else {
     $mail->From($author);
     $mail->ReplyTo($CONFIG["reply_to"]);
 }
 $mail->To($recipient);
 if ($cc) {
     $mail->Cc($cc);
 }
 $mail->Subject("[#{$ticket_parent}] " . trim($subject));
 $mail->Body($followup);
 $mail->Send() || fatal_error("Unable to mail followup.  Quit without recording followup to database.");
 /* escape special characters */
 $author = db_escape($author);
 $recipient = db_escape($recipient);
 $subject = db_escape($subject);
 $followup = db_escape($followup);
 $cc = db_escape($cc);
 /* do database insert */
 $query = "INSERT INTO tickets (author, subject, recipient, body, cc, timestamp, type, assignment, parent) ";
 $query .= "VALUES ('{$author}','{$subject}','{$recipient}','{$followup}','{$cc}','{$timestamp}','Staff Followup','9999','{$ticket_parent}')";
 do_query($query);
 /* update parent activity */
//Call the function to setup reviwer account
while (list($memberName, $email) = each($arrEmails)) {
    //Update the mail log
    $result = updateMailLog($memberName, $arrLetterInfo["letterID"]);
    //If can log the email
    if ($result === true) {
        //Send Email to user
        $mail = new Mail();
        $mail->Organization($conferenceInfo->ConferenceCodeName);
        $mail->ReplyTo($conferenceInfo->ConferenceContact);
        $mail->From($conferenceInfo->ConferenceContact);
        $mail->To($email);
        $mail->Subject(stripslashes($arrLetterInfo["subject"]));
        $mail->Body($arrContent[$memberName]);
        if ($arrLetterInfo["cc"] != "") {
            $mail->Cc($arrLetterInfo["cc"]);
        }
        $mail->Priority(1);
        $mail->Send();
        //Log the successful send email
        $arrSuccessfulEmails[$memberName] = $email;
    } else {
        do_html_header("Error Information");
        echo "<p>{$result}</p>";
        do_html_footer();
        //Log the unsuccessful email
        $arrFaliureEmails[$memberName] = $email;
        exit;
    }
}
do_html_header("Successful Send");
Example #6
0
 public function submitBugReport($moddata, $from, $message = '', $notifyAmpolirosTeam = false)
 {
     if (is_array($moddata) and isset($moddata['email']) and strlen($from)) {
         OpenLibrary('mail.library');
         $bug_report = new Mail();
         $bug_report->From($from);
         $bug_report->ReplyTo($from);
         $bug_report->To($moddata['email']);
         $bug_report->Subject('Ampoliros bug report for ' . (strlen($moddata['module']) ? '"' . $moddata['module'] . '[' . $moddata['version'] . ']"' : 'undefined') . ' module');
         $bug_report->Body('Ampoliros bug report for ' . (strlen($moddata['module']) ? '"' . $moddata['module'] . '[' . $moddata['version'] . ']"' : 'undefined') . ' module' . "\n\n" . (strlen($message) ? 'Message from bug report submitter:' . "\n\n" . $message . "\n\n" : "\n\n"));
         if ($notifyAmpolirosTeam and $moddata['email'] != $moddata['ampolirosemail']) {
             $bug_report->Cc($moddata['ampolirosemail']);
         }
         $bug_report->Attach(TMP_PATH . 'pids/' . $this->mPid, 'text/plain', 'attachment');
         $bug_report->Send();
         return true;
     }
     return false;
 }