addHeader() 공개 메소드

Add a custom header to the message
public addHeader ( string $name, string $value, boolean $append = false ) : Zend_Mail
$name string
$value string
$append boolean
리턴 Zend_Mail Provides fluent interface
예제 #1
0
 public function sendMail()
 {
     if (func_num_args() >= 4) {
         $to = func_get_arg(0);
         $from = func_get_arg(1);
         $subject = func_get_arg(2);
         $messageRecieved = func_get_arg(3);
         $tr = new Zend_Mail_Transport_Smtp($this->_host, array('auth' => 'login', 'username' => $this->_username, 'password' => $this->_password, 'port' => $this->_port));
         Zend_Mail::setDefaultTransport($tr);
         $mail = new Zend_Mail('utf-8');
         $mail->setFrom($from);
         $mail->setBodyHtml($messageRecieved);
         $mail->addTo($to);
         $mail->setSubject($subject);
         $mail->addHeader('MIME-Version', '1.0');
         $mail->addHeader('Content-Transfer-Encoding', '8bit');
         $mail->addHeader('X-Mailer:', 'PHP/' . phpversion());
         try {
             $mail->send();
             $response = "Mail sent";
             return $response;
         } catch (Exception $e) {
             throw new Zend_Controller_Action_Exception('SendGrid Mail sending error', 500);
         }
     } else {
         throw new Zend_Controller_Action_Exception('Paramter Not passed', 500);
     }
 }
function grade_below_threshold_notice($assessment_list)
{
    global $db, $AGENT_CONTACTS;
    $assessment_list = (array) $assessment_list;
    foreach ($assessment_list as $assessment_id => $assessment) {
        $mail = new Zend_Mail();
        $mail->addHeader("X-Originating-IP", $_SERVER["REMOTE_ADDR"]);
        $mail->addHeader("X-Section", "Gradebook Notification System", true);
        $mail->clearFrom();
        $mail->clearSubject();
        $mail->setFrom($AGENT_CONTACTS["agent-notifications"]["email"], APPLICATION_NAME . ' Gradebook System');
        $mail->setSubject("Grade Below Threshold Notification");
        $message = "<pre>This notification is being sent to inform you that students scored below the assessment threshold.\n\n";
        $message .= "Course:\t\t\t" . $assessment["course_name"] . " - " . $assessment["course_code"] . "\n";
        $message .= "Assessment:\t\t<a href=\"" . ENTRADA_URL . "/admin/gradebook/assessments?section=grade&id=" . $assessment["course_id"] . "&assessment_id=" . $assessment_id . "\">" . $assessment["assessment_name"] . "</a>\n";
        $message .= "Assessment ID:\t\t" . $assessment_id . "\n";
        $message .= "Grade Threshold:\t" . $assessment["threshold"] . "%\n\n";
        $message .= "The following students scored below the assessment threshold:\n";
        $message .= "-------------------------------------------------------------\n\n";
        foreach ($assessment["students"] as $proxy_number => $student) {
            $query = "\tUPDATE `assessment_grades`\n\t\t\t\t\t\tSET `threshold_notified` = '1'\n\t\t\t\t\t\tWHERE `grade_id` = " . $db->qstr($student["grade_id"]);
            $result = $db->Execute($query);
            $message .= "Student:\t\t" . $student["student_name"] . " - [" . $student["student_email"] . "] \n";
            $message .= "Student Number:\t\t" . $student["student_number"] . "\n";
            $message .= "Grade Recieved:\t\t" . $student["assessment_grade"] . "%\n\n";
        }
        $message .= "</pre>";
        $mail->setBodyHtml($message);
        $query = "\tSELECT a.`contact_type`, a.`contact_order`, b.`prefix`, b.`firstname`, b.`lastname`, b.`email`, a.`proxy_id`\n\t\t\tFROM " . DATABASE_NAME . ".`course_contacts` AS a \n\t\t\tJOIN " . AUTH_DATABASE . ".`user_data` AS b \n\t\t\tON a.`proxy_id` = b.`id`  \n\t\t\tWHERE a.`course_id` = " . $db->qstr($assessment["course_id"]) . "\n\t\t\tORDER BY a.`contact_type` DESC, a.`contact_order` ASC";
        $contacts = $db->GetAll($query);
        foreach ($contacts as $contact) {
            $mail->addTo($contact["email"], (!empty($contact["prefix"]) ? $contact["prefix"] . " " : "") . $contact["firstname"] . " " . $contact["lastname"]);
            $contact_proxies[] = $contact["proxy_id"];
        }
        $sent = true;
        try {
            $mail->send();
        } catch (Exception $e) {
            $sent = false;
        }
        if ($sent) {
            application_log("success", "Sent grade below threshold notification to Program Coordinators / Directors [" . implode(",", $contact_proxies) . "].");
            $return_value = true;
        } else {
            application_log("error", "Unable to send grade below threshold notification to Program Coordinators / Directors [" . implode(",", $contact_proxies) . "].");
        }
    }
}
function sendNotification($result)
{
    global $AGENT_CONTACTS, $db;
    if ($result["preceptor_proxy_id"] != 0) {
        $query = "SELECT `prefix`, `firstname`, `lastname`, `email` FROM `" . AUTH_DATABASE . "`.`user_data` WHERE `id` = " . $db->qstr($result["preceptor_proxy_id"]);
        $preceptor = $db->GetRow($query);
        $preceptor_email = $preceptor["email"];
        $preceptor_name = (!empty($preceptor["prefix"]) ? $preceptor["prefix"] . " " : "") . $preceptor["firstname"] . " " . $preceptor["lastname"];
    } else {
        $preceptor_email = $result["preceptor_email"];
        $preceptor_name = $result["preceptor_firstname"] . " " . $result["preceptor_lastname"];
    }
    if ($preceptor_email) {
        $ENTRADA_USER = User::get($result["student_id"]);
        $message = $preceptor_name . ",\n\n";
        $message .= "You have been indicated as the preceptor on an Observership:\n" . "======================================================\n" . "Submitted at: " . date("Y-m-d H:i", time()) . "\n" . "Submitted by: " . $ENTRADA_USER->getFullname(false) . "\n" . "E-Mail Address: " . $ENTRADA_USER->getEmail() . "\n" . "Observership details:\n" . "---------------------\n" . "Title: " . $result["title"] . "\n" . "Activity Type: " . $result["activity_type"] . "\n" . ($result["activity_type"] == "ipobservership" ? "IP Observership Details: " . $result["activity_type"] . "\n" : "") . "Clinical Discipline: " . $result["clinical_discipline"] . "\n" . "Organisation: " . $result["organisation"] . "\n" . "Address: " . $result["address_l1"] . "\n" . "Preceptor: " . $preceptor_name . "\n" . "Start date: " . date("Y-m-d", $result["start"]) . "\n" . "End date: " . date("Y-m-d", $result["end"]) . "\n\n" . "The observership request can be approved or rejected at the following address:\n" . ENTRADA_URL . "/confirm_observership?unique_id=" . $result["unique_id"];
        $mail = new Zend_Mail();
        $mail->addHeader("X-Section", "Observership Confirmation", true);
        $mail->setFrom($AGENT_CONTACTS["general-contact"]["email"], $AGENT_CONTACTS["general-contact"]["name"]);
        $mail->setSubject("Observership Confirmation");
        $mail->setBodyText($message);
        $mail->addTo($preceptor_email, $preceptor_name);
        if ($mail->send()) {
            $query = "UPDATE `student_observerships` SET `notice_sent` = " . $db->qstr(time()) . " WHERE `id` = " . $db->qstr($result["id"]);
            if ($db->Execute($query)) {
                return true;
                application_log("success", "Sent observership notification to [" . $preceptor_email . "] for observership_id [" . $result["id"] . "].");
            }
        } else {
            application_log("error", "Unable to send observership [observership_id: " . $result["id"] . "] confirmation request.");
            return false;
        }
    }
}
예제 #4
0
 protected function _sendEmail(array $email, array $user, Zend_Mail_Transport_Abstract $transport)
 {
     if (!$user['email']) {
         return;
     }
     $phraseTitles = XenForo_Helper_String::findPhraseNamesFromStringSimple($email['email_title'] . $email['email_body']);
     /** @var XenForo_Model_Phrase $phraseModel */
     $phraseModel = XenForo_Model::create('XenForo_Model_Phrase');
     $phrases = $phraseModel->getPhraseTextFromPhraseTitles($phraseTitles, $user['language_id']);
     foreach ($phraseTitles as $search => $phraseTitle) {
         if (isset($phrases[$phraseTitle])) {
             $email['email_title'] = str_replace($search, $phrases[$phraseTitle], $email['email_title']);
             $email['email_body'] = str_replace($search, $phrases[$phraseTitle], $email['email_body']);
         }
     }
     $mailObj = new Zend_Mail('utf-8');
     $mailObj->setSubject($email['email_title'])->addTo($user['email'], $user['username'])->setFrom($email['from_email'], $email['from_name']);
     $options = XenForo_Application::getOptions();
     $bounceEmailAddress = $options->bounceEmailAddress;
     if (!$bounceEmailAddress) {
         $bounceEmailAddress = $options->defaultEmailAddress;
     }
     $toEmail = $user['email'];
     $bounceHmac = substr(hash_hmac('md5', $toEmail, XenForo_Application::getConfig()->globalSalt), 0, 8);
     $mailObj->addHeader('X-To-Validate', "{$bounceHmac}+{$toEmail}");
     if ($options->enableVerp) {
         $verpValue = str_replace('@', '=', $toEmail);
         $bounceEmailAddress = str_replace('@', "+{$bounceHmac}+{$verpValue}@", $bounceEmailAddress);
     }
     $mailObj->setReturnPath($bounceEmailAddress);
     if ($email['email_format'] == 'html') {
         $replacements = array('{name}' => htmlspecialchars($user['username']), '{email}' => htmlspecialchars($user['email']), '{id}' => $user['user_id']);
         $email['email_body'] = strtr($email['email_body'], $replacements);
         $text = trim(htmlspecialchars_decode(strip_tags($email['email_body'])));
         $mailObj->setBodyHtml($email['email_body'])->setBodyText($text);
     } else {
         $replacements = array('{name}' => $user['username'], '{email}' => $user['email'], '{id}' => $user['user_id']);
         $email['email_body'] = strtr($email['email_body'], $replacements);
         $mailObj->setBodyText($email['email_body']);
     }
     if (!$mailObj->getMessageId()) {
         $mailObj->setMessageId();
     }
     $thisTransport = XenForo_Mail::getFinalTransportForMail($mailObj, $transport);
     try {
         $mailObj->send($thisTransport);
     } catch (Exception $e) {
         if (method_exists($thisTransport, 'resetConnection')) {
             XenForo_Error::logException($e, false, "Email to {$user['email']} failed: ");
             $thisTransport->resetConnection();
             try {
                 $mailObj->send($thisTransport);
             } catch (Exception $e) {
                 XenForo_Error::logException($e, false, "Email to {$user['email']} failed (after retry): ");
             }
         } else {
             XenForo_Error::logException($e, false, "Email to {$user['email']} failed: ");
         }
     }
 }
예제 #5
0
 public function sendEmail($message)
 {
     $mail = new Zend_Mail();
     $mail->addHeader('X-MailGenerator', 'The Portable Antiquities Scheme - Beowulf');
     $mail->setBodyText('Server down!' . "\n" . $message);
     $mail->setFrom('*****@*****.**', 'The Portable Antiquities Scheme');
     $mail->addTo('*****@*****.**', 'Daniel Pett');
     $mail->setSubject('Do something about server');
     $mail->send();
 }
예제 #6
0
 /**
  * $from_email, $from_name, $to_email, $to_name, $subj, $body
  *
  * @param <type> $from_email
  * @param <type> $from_name
  * @param <type> $to_email
  * @param <type> $to_name
  * @param <type> $body
  * @param <type> $subj
  */
 public function mySendEmail($from_email, $from_name = 'Webacula', $to_email, $to_name = '', $subj, $body)
 {
     Zend_Loader::loadClass('Zend_Mail');
     $mail = new Zend_Mail('utf-8');
     $mail->addHeader('X-MailGenerator', 'webacula');
     $mail->setBodyText($body, 'UTF-8');
     $mail->setFrom($from_email, $from_name);
     $mail->addTo($to_email, $to_name);
     $mail->setSubject($subj);
     return $mail->send();
 }
예제 #7
0
파일: Log.php 프로젝트: KasaiDot/FansubCMS
 /**
  * 
  * constructs the helper
  */
 protected function __construct()
 {
     if (APPLICATION_ENV != 'production') {
         $writer = new Zend_Log_Writer_Firebug();
         $writer->setDefaultPriorityStyle('EXCEPTION');
     } else {
         $mailConfig = Zend_Registry::get('emailSettings');
         if ($mtconf->sendmail) {
             $mtconf = array('auth' => 'login', 'username' => $mailConfig->smtp->user, 'password' => $mailConfig->smtp->password, 'port' => $mailConfig->smtp->port);
             if ($mailConfig->smtp->ssl) {
                 $mtconf['ssl'] = 'tls';
             }
             $transport = new Zend_Mail_Transport_Smtp($mailConfig->smtp->host, $mtconf);
         } else {
             $transport = new Zend_Mail_Transport_Sendmail();
         }
         Zend_Mail::setDefaultTransport($transport);
         $mail = new Zend_Mail('UTF-8');
         $mail->setFrom($mailConfig->email->noreply, 'FansubCMS Error Report');
         $mail->addTo($mailConfig->email->admin, 'FansubCMS Technical Administrator at' . $_SERVER['HTTP_HOST']);
         $mail->addHeader('X-MailGenerator', 'Log handler on FansubCMS');
         $mail->addHeader('X-Mailer', 'FansubCMS');
         $mail->addHeader('X-Priority', '3');
         $writer = new Zend_Log_Writer_Mail($mail);
         $writer->setSubjectPrependText('FansubCMS Error: ');
     }
     switch (APPLICATION_ENV) {
         case 'debug':
             // is handled by dev bar through
             $writer->addFilter(Zend_Log::DEBUG);
             break;
         case 'testing':
             $writer->addFilter(Zend_Log::NOTICE);
             break;
         default:
             $writer->addFilter(Zend_Log::ERR);
             break;
     }
     $logger = new Zend_Log($writer);
     self::$_logger = $logger;
 }
예제 #8
0
 public function registerAction()
 {
     if (Zend_Auth::getInstance()->hasIdentity()) {
         $this->_helper->redirector('index', 'index', 'default');
     }
     $form = new Application_Form_Register();
     $this->view->form = $form;
     $validator = new Zend_Validate_Db_NoRecordExists(array('table' => 'users', 'field' => 'email'));
     if ($this->getRequest()->isPost()) {
         $formData = $this->getRequest()->getPost();
         if ($form->isValid($formData)) {
             $email = $this->getRequest()->getPost('email');
             if ($validator->isValid($email)) {
                 $username = $this->getRequest()->getPost('login');
                 $password = $this->getRequest()->getPost('pass');
                 $date = time();
                 $user = new Application_Model_DbTable_User();
                 $result = $user->addUser($username, md5($password), $email, $date);
                 $message = "Вы успешно зарегистрировались на сайте Serializm.com.\r\nЛогин: " . $username . "\r\nПароль: " . $password . "\r\nС уважением, Администрация Serializm.com";
                 $transport = new Zend_Mail_Transport_Smtp();
                 Zend_Mail::setDefaultTransport($transport);
                 $mail = new Zend_Mail('utf-8');
                 $mail->setReplyTo('*****@*****.**', 'Администратор');
                 $mail->addHeader('MIME-Version', '1.0');
                 $mail->addHeader('Content-Transfer-Encoding', '8bit');
                 $mail->addHeader('X-Mailer:', 'PHP/' . phpversion());
                 $mail->setBodyText($message);
                 $mail->setFrom('*****@*****.**', 'Администратор');
                 $mail->addTo($email);
                 $mail->setSubject('Успешная регистрация на serializm.com');
                 $mail->send();
                 if ($result) {
                     $this->_helper->redirector('index', 'index', 'default');
                 }
             } else {
                 $this->view->errMessage = $validator->getMessages();
             }
         }
     }
 }
예제 #9
0
 public function indexAction()
 {
     $req = $this->getRequest();
     $this->view->form = new Group_Form_Contact('contact');
     if ($req->isPost()) {
         if ($this->view->form->isValid($_POST)) {
             // we need the email settings from the registry
             $this->mailsettings = Zend_Registry::get('emailSettings');
             $values = $this->view->form->getValues();
             if (!$this->mailsettings->sendmail) {
                 $mtconf = array('auth' => 'login', 'username' => $this->mailsettings->smtp->user, 'password' => $this->mailsettings->smtp->password, 'port' => $this->mailsettings->smtp->port);
                 if ($this->mailsettings->smtp->ssl) {
                     $mtconf['ssl'] = 'tls';
                 }
                 $mtr = new Zend_Mail_Transport_Smtp($this->mailsettings->smtp->host, $mtconf);
             } else {
                 $mtr = new Zend_Mail_Sendmail();
             }
             $mailer = new Zend_Mail('UTF-8');
             $mailer->setFrom($values['email'], $values['author']);
             $mailer->addTo($this->mailsettings->email->admin, 'FansubCMS Administration');
             $mailer->setMessageId();
             $mailer->setSubject('FansubCMS Contact');
             $mailer->addHeader('X-MailGenerator', 'ContactForm on FansubCMS');
             $mailer->addHeader('X-Mailer', 'FansubCMS');
             $mailer->addHeader('X-Priority', '3');
             $message = $this->translate('contact_mail_text', array('name' => $values['author'], 'email' => $values['email'], 'text' => $values['content']));
             $mailer->setBodyText($message, 'UTF-8');
             if ($mailer->send($mtr)) {
                 $this->view->message = $this->translate('group_contact_mail_sent_successful');
                 $this->view->form = new Group_Form_Contact('contact');
             }
         }
     }
     $this->view->title = $this->translate('group_contact_title');
 }
예제 #10
0
 private function sendEmail($emailMessage, $recipients)
 {
     $mailerConfig = Zend_Registry::get("config")->mail;
     $transport = new Zend_Mail_Transport_Smtp($mailerConfig->host, $mailerConfig->smtpconfig->toArray());
     Zend_Mail::setDefaultTransport($transport);
     $email = new Zend_Mail('UTF-8');
     $email->setHeaderEncoding(Zend_Mime::ENCODING_BASE64);
     $email->addHeader('Content-type', 'text/html');
     $email->setFrom($emailMessage->getSenderAddress(), $emailMessage->getSenderName());
     $email->setSubject($emailMessage->getSubject());
     $email->setBodyHtml($emailMessage->getBody(), 'UTF-8');
     foreach ($recipients as $recipient) {
         $email->addBcc($recipient->getAddress(), $recipient->getName());
     }
     $email->send();
 }
예제 #11
0
 /** direct method for action controller
  * @access public
  * @param array $assignData
  * @param string $type
  * @param array $to
  * @param array $cc
  * @param array $from
  * @param array $bcc
  * @param array $attachments
  */
 public function direct(array $assignData = null, $type, array $to = null, array $cc = null, array $from = null, array $bcc = null, array $attachments = null)
 {
     $script = $this->_getTemplate($type);
     $message = $this->_view->setScriptPath($this->_templates);
     $this->_view->addHelperPath('Pas/View/Helper/', 'Pas_View_Helper');
     $message->assign($assignData);
     $html = $message->render($script);
     $text = $this->_stripper($html);
     $this->_mail->addHeader('X-MailGenerator', 'Portable Antiquities Scheme');
     $this->_mail->setBodyHtml($html);
     $this->_mail->setBodyText($text);
     $this->_setUpSending($to, $cc, $from, $bcc);
     if (!is_null($attachments)) {
         $this->_addAttachments($attachments);
     }
     $this->_sendIt();
 }
예제 #12
0
 /**
  * This shows the cart details
  * 
  * @return void
  */
 public function indexAction()
 {
     if ($this->getRequest()->isPost()) {
         $params = $this->getAllParams();
         unset($errors);
         if (strlen(trim($params['name'])) == 0) {
             $errors['name'] = "Le nom est obligatoire";
         }
         if (strlen(trim($params['email'])) == 0) {
             $errors['email'] = "L'adresse email est obligatoire";
         } elseif (!filter_var($params['email'], FILTER_VALIDATE_EMAIL)) {
             $errors['email'] = "L'adresse email n'est pas valide";
         }
         if (strlen(trim($params['subject'])) == 0) {
             $errors['subject'] = "Le sujet est obligatoire";
         }
         if (strlen(trim($params['message'])) == 0) {
             $errors['message'] = "Le message est obligatoire";
         }
         if ($errors) {
             $this->view->errors = $errors;
         } else {
             $to = get_option('administrator_email');
             $body = "Bonjour" . "\n\n";
             $body .= "Une nouvelle demande d'information vient d'être formulée depuis le site histoirealasource.ille-et-vilaine.fr, voici les informations :" . "\n\n";
             $body .= "Nom du contact : " . $params['name'] . "\n\n";
             $body .= "Email du contact : " . $params['email'] . "\n\n";
             $body .= "Sujet : " . $params['subject'] . "\n\n";
             $body .= "Message : " . $params['message'] . "\n\n";
             $subject = "Nouvelle demande d'informations depuis le site histoirealasource.ille-et-vilaine.fr";
             $mail = new Zend_Mail('UTF-8');
             $mail->setBodyText($body);
             $mail->setFrom('*****@*****.**');
             $mail->addTo($to);
             $mail->setSubject($subject);
             $mail->addHeader('X-Mailer', 'PHP/' . phpversion());
             $mail->send();
             $this->view->ok = true;
         }
         $this->view->params = $params;
     }
     $ariane['contact'] = null;
     $this->view->ariane = $ariane;
 }
 protected function afterSave($args)
 {
     if ($args['insert']) {
         $mail = new Zend_Mail('UTF-8');
         $mail->addHeader('X-Mailer', 'PHP/' . phpversion());
         $mail->setFrom(get_option('administrator_email'), get_option('site_title'));
         $correctionEmail = get_option('corrections_email');
         if (empty($correctionEmail)) {
             $correctionEmail = get_option('administrator_email');
         }
         $mail->addTo($correctionEmail);
         $subject = __("A correction has been submitted to %s", get_option('site_title'));
         $body = "<p>" . __("Please see %s to evaluate the correction.", "<a href='" . WEB_ROOT . "/admin/corrections/index/show/id/{$this->id}'>this</a>") . "</p>";
         $mail->setSubject($subject);
         $mail->setBodyHtml($body);
         try {
             $mail->send();
         } catch (Exception $e) {
             _log($e);
         }
     }
 }
예제 #14
0
 public static function sendMail($mail_to, $mail_type, $params)
 {
     $translate_messages_model = new Locale_Model_TranslateMessages();
     $users_model = new Users_Model_Users();
     $countries_model = new Locale_Model_Countries();
     //potrebno je u translate_messages ubaciti za ove keyeve values, koji ce sadrzati subject odnosno body maila.
     //Obavezno u body ubaciti i linkove, gde bi se menjao samo verification_code
     switch ($mail_type) {
         case 'send_verification':
             $subject_key = 'send_verification_email_subject';
             $body_key = 'send_verification_email_body';
             break;
         case 'password_recovery':
             $subject_key = 'password_recovery_email_subject';
             $body_key = 'password_recovery_email_body';
             break;
     }
     $locale = $countries_model->getLanguageLocale($params['country_id']);
     $subject = $translate_messages_model->getTranslateForLocale($subject_key, $locale);
     $body = $translate_messages_model->getTranslateForLocale($body_key, $locale);
     //replaces {verification_code} with code for that user
     $edited_body = str_replace('{verification_code}', $params['code'], $body);
     $edited_body = str_replace('{client_url}', Zend_Registry::get('client_url'), $edited_body);
     $mail = new Zend_Mail('UTF-8');
     $mail->addHeader('X-Mailer:', 'PHP/' . phpversion());
     $mail->addTo($mail_to);
     //pokupiti iz configa setfrom and setreplyto
     $mail->setFrom(Zend_Registry::get('email_verification_sender_email'))->setReplyTo(Zend_Registry::get('email_verification_sender_email'))->setSubject($subject)->setBodyHtml($edited_body);
     try {
         $mail->send();
         return true;
     } catch (Zend_Mail_Transport_Exception $e) {
         mail('*****@*****.**', 'Weight Manager Error', 'Error sending mail: ');
         return false;
     }
 }
예제 #15
0
 protected static function sendUsingZendMail($transport = null)
 {
     ProjectConfiguration::registerZend();
     $mail = new Zend_Mail();
     $mail->addHeader('X-MailGenerator', ProjectConfiguration::getApplicationName());
     $mail->setBodyText(self::$_message);
     $mail->setBodyHtml(self::$_html_message);
     $mail->setFrom(self::$_from);
     if (is_array(self::$_to)) {
         foreach (self::$_to as $send_to) {
             $mail->addTo($send_to);
         }
     } else {
         $mail->addTo(self::$_to);
     }
     $mail->setSubject(self::$_subject);
     if (sfConfig::get('sf_environment') != 'prod') {
         if (sfConfig::get('sf_logging_enabled')) {
             sfContext::getInstance()->getLogger()->info('Mail sent: ' . $mail->getBodyText()->getRawContent());
         }
         return false;
     }
     return $mail->send($transport);
 }
예제 #16
0
 protected function _getMail($user, $body, $subject)
 {
     $siteTitle = get_option('site_title');
     $from = get_option('administrator_email');
     $mail = new Zend_Mail('UTF-8');
     $mail->setBodyHtml($body);
     $mail->setFrom($from, __("%s Administrator", $siteTitle));
     $mail->addTo($user->email, $user->name);
     $mail->setSubject($subject);
     $mail->addHeader('X-Mailer', 'PHP/' . phpversion());
     return $mail;
 }
예제 #17
0
 /** Send email notifications
  * @access public
  * @return void
  * @param string $message
  */
 public function notify($message)
 {
     $mail = new Zend_Mail();
     $mail->addHeader('X-MailGenerator', 'The Portable Antiquities Scheme - Beowulf');
     $mail->setBodyText($message);
     $mail->setFrom('*****@*****.**', 'The Portable Antiquities Scheme');
     $mail->addTo($this->_config->admin->email);
     $mail->setSubject('Backup process status on main server');
     $mail->send();
 }
 /**
  * set headers in mail to be sent
  * 
  * @param Tinebase_Mail $_mail
  * @param Felamimail_Model_Account $_account
  * @param Felamimail_Model_Message $_message
  */
 protected function _setMailHeaders(Zend_Mail $_mail, Felamimail_Model_Account $_account, Felamimail_Model_Message $_message = NULL)
 {
     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Setting mail headers');
     }
     // add user agent
     $_mail->addHeader('User-Agent', 'Tine 2.0 Email Client (version ' . TINE20_CODENAME . ' - ' . TINE20_PACKAGESTRING . ')');
     // set organization
     if (isset($_account->organization) && !empty($_account->organization)) {
         $_mail->addHeader('Organization', $_account->organization);
     }
     // set message-id (we could use Zend_Mail::createMessageId() here)
     if ($_mail->getMessageId() === NULL) {
         $domainPart = substr($_account->email, strpos($_account->email, '@'));
         $uid = Tinebase_Record_Abstract::generateUID();
         $_mail->setMessageId('<' . $uid . $domainPart . '>');
     }
     if ($_message !== NULL) {
         if ($_message->flags && $_message->flags == Zend_Mail_Storage::FLAG_ANSWERED && $_message->original_id instanceof Felamimail_Model_Message) {
             $this->_addReplyHeaders($_message);
         }
         // set the header request response
         if ($_message->reading_conf) {
             $_mail->addHeader('Disposition-Notification-To', $_message->from_email);
         }
         // add other headers
         if (!empty($_message->headers) && is_array($_message->headers)) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Adding custom headers: ' . print_r($_message->headers, TRUE));
             }
             foreach ($_message->headers as $key => $value) {
                 $value = $this->_trimHeader($key, $value);
                 $_mail->addHeader($key, $value);
             }
         }
     }
 }
예제 #19
0
 /**
  * Populate mail instance
  *
  * @param Zend_Mail $mail
  * @return Zend_Mail
  */
 public function populate(Zend_Mail $mail)
 {
     if ($this->fromEmail || $this->fromName) {
         $mail->setFrom($this->fromEmail, $this->fromName);
     }
     if ($this->toEmail || $this->toName) {
         $mail->addTo($this->toEmail, $this->toName);
     }
     if ($this->bcc) {
         if (!is_array($this->bcc)) {
             $mail->addBcc($this->bcc);
         } else {
             if (isset($this->bcc['email']) && !empty($this->bcc['email'])) {
                 if (isset($this->bcc['name']) && !empty($this->bcc['name'])) {
                     $mail->addBcc($this->bcc['email'], $this->bcc['name']);
                 } else {
                     $mail->addBcc($this->bcc['email']);
                 }
             } elseif (count($this->bcc)) {
                 foreach ($this->bcc as $bcEmail) {
                     $mail->addBcc($bcEmail);
                 }
             }
         }
     }
     if ($this->subject) {
         $mail->setSubject($this->subject);
     }
     if ($this->bodyHtml) {
         $mail->setBodyHtml($this->bodyHtml);
     }
     if ($this->bodyText) {
         $mail->setBodyText($this->bodyText);
     }
     if ($this->attachments && is_array($this->attachments)) {
         foreach ($this->attachments as $file) {
             if (file_exists($file['path'])) {
                 $fileContent = file_get_contents($file['path']);
                 if ($fileContent) {
                     $attachment = new Zend_Mime_Part($fileContent);
                     $attachment->type = Zend_Mime::TYPE_OCTETSTREAM;
                     $attachment->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
                     $attachment->encoding = Zend_Mime::ENCODING_BASE64;
                     $attachment->filename = basename($file['path']);
                     $attachment->id = md5(time());
                     $attachment->description = $attachment->filename;
                     $mail->addAttachment($attachment);
                 }
             }
         }
     }
     if ($this->sendExternal) {
         $mail->addHeader('SEND_TO_EXTERNAL_SMTP', 'True');
     }
     return $mail;
 }
 $message .= ENTRADA_URL . "/password_reset?hash=" . rawurlencode($proxy_id . ":" . $hash) . "\n\n";
 $message .= "Please Note:\n";
 $message .= "This password link will be valid for the next 3 days. If you do not reset your\n";
 $message .= "password within this time period, you will need to reinitate this process.\n\n";
 $message .= "If you did not request a password reset for this account and you believe\n";
 $message .= "there has been a mistake, DO NOT click the above link. Please forward this\n";
 $message .= "message along with a description of the problem to: " . $AGENT_CONTACTS["administrator"]["email"] . "\n\n";
 $message .= "Best Regards,\n";
 $message .= $AGENT_CONTACTS["administrator"]["name"] . "\n";
 $message .= $AGENT_CONTACTS["administrator"]["email"] . "\n";
 $message .= ENTRADA_URL . "\n\n";
 $message .= "Requested By:\t" . $_SERVER["REMOTE_ADDR"] . "\n";
 $message .= "Requested At:\t" . date("r", time()) . "\n";
 try {
     $mail = new Zend_Mail();
     $mail->addHeader("X-Priority", "3");
     $mail->addHeader("Content-Transfer-Encoding", "8bit");
     $mail->addHeader("X-Originating-IP", $_SERVER["REMOTE_ADDR"]);
     $mail->addHeader("X-Section", "Password Reset");
     $mail->addTo($email_address, $firstname . " " . $lastname);
     $mail->setFrom($AGENT_CONTACTS["administrator"]["email"], $AGENT_CONTACTS["administrator"]["name"]);
     $mail->setSubject("Password Reset - " . APPLICATION_NAME . " Authentication System");
     $mail->setReplyTo($AGENT_CONTACTS["administrator"]["email"], $AGENT_CONTACTS["administrator"]["name"]);
     $mail->setBodyText($message);
     if ($mail->send()) {
         add_success("An e-mail has just been sent to <strong>" . html_encode($email_address) . "</strong> that contains further instructions on resetting your " . APPLICATION_NAME . " password. Please check your e-mail in a few minutes to proceed.");
         application_log("notice", "A password reset e-mail has just been sent for " . $username . " [" . $proxy_id . "].");
         $email_address = "";
     } else {
         add_error("We were unable to send you a password reset authorization e-mail at this time due to an unrecoverable error. The administrator has been notified of this error and will investigate the issue shortly.<br /><br />Please try again later, we apologize for any inconvenience this may have caused.");
         application_log("error", "Unable to send password reset notice as Zend_Mail's send function failed.");
예제 #21
0
 /**
  * send message using default transport or an instance of Zend_Mail_Transport_Abstract
  *
  * @param Zend_Mail $_mail
  * @param Zend_Mail_Transport_Abstract $_transport
  * @return void
  */
 public function sendMessage(Zend_Mail $_mail, $_transport = NULL)
 {
     $transport = $_transport instanceof Zend_Mail_Transport_Abstract ? $_transport : self::getDefaultTransport();
     $_mail->addHeader('X-MailGenerator', 'Tine 2.0');
     $_mail->send($transport);
 }
 function __construct($mail_handler)
 {
     $this->_mail_handler = $mail_handler;
     $this->_mail_handler->addHeader("X-Originating-IP", $_SERVER["REMOTE_ADDR"]);
 }
 /**
  * send mail helper
  * @author tri.van
  * @param $email
  * @param $subject
  * @param $message
  * @param $mailUserName
  * @param $mailFrom
  * @since Tue Now 3, 9:48 AM
  */
 private function sendMail($email, $subject, $message, $mailUserName, $mailFrom)
 {
     try {
         //Prepare email
         $mail = new Zend_Mail('UTF-8');
         //add headers avoid the mail direction to 'spam'/ 'junk' folder
         $mail->addHeader('MIME-Version', '1.0');
         $mail->addHeader('Content-Type', 'text/html');
         $mail->addHeader('Content-Transfer-Encoding', '8bit');
         $mail->addHeader('X-Mailer:', 'PHP/' . phpversion());
         $mail->setFrom($mailUserName, $mailFrom);
         //add reply to avoid the mail direction to 'spam'/ 'junk' folder
         $mail->setReplyTo($mailFrom, $subject);
         $mail->addTo($email);
         $mail->addBcc($mailUserName);
         $mail->setSubject($subject);
         $mail->setBodyHtml($message);
         //Send it!
         $mail->send();
         return array(true, "");
     } catch (Exception $e) {
         $sent = $e->getMessage();
         return array(false, $sent);
     }
 }
예제 #24
0
 /**
  * Gets the fully prepared, internal mail object. This can be called directly
  * to allow advanced manipulation before sending
  *
  * @param string $toEmail The email address the email is sent to
  * @param string $toName Name of the person receiving it
  * @param array $headers List of additional headers to send
  * @param string $fromEmail Email address the email should come from; if not specified, uses board default
  * @param string $fromName Name the email should come from; if not specified, uses board default
  * @param string $returnPath The return path of the email (where bounces should go to)
  *
  * @return Zend_Mail|false
  */
 public function getPreparedMailHandler($toEmail, $toName = '', array $headers = array(), $fromEmail = '', $fromName = '', $returnPath = '')
 {
     $contents = $this->prepareMailContents();
     if (!$contents) {
         return false;
     }
     $contents = $this->wrapMailContainer($contents['subject'], $contents['bodyText'], $contents['bodyHtml']);
     $mailObj = new Zend_Mail('utf-8');
     $mailObj->setSubject($contents['subject'])->setBodyText($contents['bodyText'])->addTo($toEmail, $toName);
     if ($contents['bodyHtml'] !== '') {
         $mailObj->setBodyHtml($contents['bodyHtml']);
     }
     $options = XenForo_Application::get('options');
     if (!$fromName) {
         $fromName = $options->emailSenderName ? $options->emailSenderName : $options->boardTitle;
     }
     if ($fromEmail) {
         $mailObj->setFrom($fromEmail, $fromName);
     } else {
         $mailObj->setFrom($options->defaultEmailAddress, $fromName);
     }
     if ($returnPath) {
         $mailObj->setReturnPath($returnPath);
     } else {
         $bounceEmailAddress = $options->bounceEmailAddress;
         if (!$bounceEmailAddress) {
             $bounceEmailAddress = $options->defaultEmailAddress;
         }
         $mailObj->setReturnPath($bounceEmailAddress);
     }
     foreach ($headers as $headerName => $headerValue) {
         $mailObj->addHeader($headerName, $headerValue);
     }
     return $mailObj;
 }
예제 #25
0
파일: Send.php 프로젝트: bjtenao/tudu-web
 /**
  * 发送邮件
  *
  * @param array $params
  */
 public function sendEmail($params)
 {
     if (empty($params['emails']) || empty($params['content']) || empty($params['subject']) || empty($params['url']) || empty($params['sender']) || empty($params['type']) || empty($params['lastupdate']) || empty($params['tuduid'])) {
         return;
     }
     $tpl = $this->_options['data']['path'] . '/templates/tudu/rule_mail_notify.tpl';
     if (!file_exists($tpl) || !is_readable($tpl)) {
         $this->getLogger()->warn("Tpl file:\"rule_mail_notify.tpl\" is not exists");
         return;
     }
     $tuduId = $params['tuduid'];
     $emails = $params['emails'];
     $common = $params;
     unset($common['emails']);
     unset($common['tuduid']);
     $mailTransport = $this->getMailTransport($this->_balancer->select());
     $template = $this->_assignTpl(file_get_contents($tpl), $common);
     foreach ($emails as $email) {
         try {
             $mail = new Zend_Mail('utf-8');
             $mail->setFrom($this->_options['smtp']['from']['alert'], urldecode($this->_options['smtp']['fromname']));
             $mail->addTo($email);
             $mail->addHeader('tid', $tuduId);
             $mail->setSubject("邮件主题:" . $params['subject']);
             $mail->setBodyHtml($template);
             $mail->send($mailTransport);
         } catch (Zend_Mail_Exception $ex) {
             $this->getLogger()->warn("[Failed] Send rule email notify TuduId:{$tuduId} retry\n{$ex}");
             continue;
         }
     }
     $this->getLogger()->debug("Send rule email notify id:{$tuduId} done");
 }
 * @author Organisation: Queen's University
 * @author Unit: Faculty of Medicine
 * @author Developer: Brandon Thorn <*****@*****.**>
 * @author Developer: Ryan Warner <*****@*****.**>
 * @copyright Copyright 2012 Queen's Univerity. All Rights Reserved.
 * if they're doing a clerkship rotation in a location that the regional education manages (oshawa)
 */
@set_time_limit(0);
@set_include_path(implode(PATH_SEPARATOR, array(dirname(__FILE__) . "/../core", dirname(__FILE__) . "/../core/includes", dirname(__FILE__) . "/../core/library", get_include_path())));
/**
 * Include the Entrada init code.
 */
require_once "init.inc.php";
$search = array("%LEARNER_NAME%", "%ACCOMMODATION_TITLE%", "%ACCOMMODATION_NUMBER%", "%ACCOMMODATION_STREET%", "%ACCOMMODATION_REGION%", "%INHABITING_START%", "%INHABITING_FINISH%", "%ACCOMMODATION_CONTACT_NAME%", "%ACCOMMODATION_CONTACT_INFO%", "%ACCOMMODATION_LINK%", "%APPLICATION_NAME%");
$mail = new Zend_Mail();
$query = "\tSELECT c.`username`,\n\t\t\t\tCONCAT_WS(' ', c.`firstname`, c.`lastname`) AS `fullname`,\n\t\t\t\tc.`email`,\n\t\t\t\ta.`apartment_title`,\n\t\t\t\ta.`apartment_number`,\n\t\t\t\ta.`apartment_address`,\n\t\t\t\td.`region_name`,\n\t\t\t\ta.`apartment_province`,\n\t\t\t\tb.`aschedule_id`,\n\t\t\t\tFROM_UNIXTIME(b.inhabiting_start) AS inhabiting_start,\n\t\t\t\tFROM_UNIXTIME(b.inhabiting_finish) AS inhabiting_finish,\n\t\t\t\te.`department_id`,\n\t\t\t\te.`department_title`\n\t\t\tFROM `" . CLERKSHIP_DATABASE . "`.`apartments` AS a\n\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`apartment_schedule` AS b\n\t\t\tON a.`apartment_id` = b.`apartment_id`\n\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`user_data` as c\n\t\t\tON b.`proxy_id` = c.`id`\n\t\t\tLEFT JOIN `" . CLERKSHIP_DATABASE . "`.`regions` as d\n\t\t\tON a.`region_id` = d.`region_id`\n\t\t\tLEFT JOIN `" . AUTH_DATABASE . "`.`departments` as e\n\t\t\tON a.`department_id` = e.`department_id`\n\t\t\tWHERE b.`occupant_title` = ''\n\t\t\tAND DATEDIFF(FROM_UNIXTIME(b.`inhabiting_start`), FROM_UNIXTIME('" . time() . "')) = 30";
$occupants = $db->GetAll($query);
if ($occupants) {
    $email_body = file_get_contents(ENTRADA_ABSOLUTE . "/templates/" . $ENTRADA_TEMPLATE->activeTemplate() . "/email/regionaled-learner-accommodation-notification.txt");
    foreach ($occupants as $occupant) {
        $mail->addHeader("X-Section", $occupant["department_title"] . " Accommodation Notification System", true);
        $mail->setFrom($AGENT_CONTACTS["agent-regionaled"][$occupant["department_id"]]["email"], $AGENT_CONTACTS["agent-regionaled"][$occupant["department_id"]]["name"]);
        $mail->clearSubject();
        $mail->setSubject("Regional Accomodation: " . $occupant["region_name"]);
        $replace = array($occupant["fullname"], $occupant["apartment_title"], $occupant["apartment_number"], $occupant["apartment_address"], $occupant["region_name"], date("l, F j, Y", strtotime($occupant["inhabiting_start"])), date("l, F j, Y", strtotime($occupant["inhabiting_finish"])), $AGENT_CONTACTS["agent-regionaled"][$occupant["department_id"]]["name"], $AGENT_CONTACTS["agent-regionaled"][$occupant["department_id"]]["email"], "https://meds.queensu.ca/central/regionaled/view?id=" . $occupant["aschedule_id"], $AGENT_CONTACTS["agent-regionaled"][$occupant["department_id"]]["name"]);
        $mail->setBodyText(str_replace($search, $replace, $email_body));
        $mail->clearRecipients();
        $mail->addTo($occupant["email"], $occupant["fullname"]);
        $mail->send();
    }
}
예제 #27
0
 /**
  * Send an activation email to a new user telling them how to activate
  * their account.
  *
  * @param User $user
  * @return boolean True if the email was successfully sent, false otherwise.
  */
 protected function sendActivationEmail($user)
 {
     $ua = $this->_helper->db->getTable('UsersActivations')->findByUser($user);
     if ($ua) {
         $ua->delete();
     }
     $ua = new UsersActivations();
     $ua->user_id = $user->id;
     $ua->save();
     // send the user an email telling them about their new user account
     $siteTitle = get_option('site_title');
     $from = get_option('administrator_email');
     $body = __('Welcome!') . "\n\n" . __('Your account for the %s repository has been created. Please click the following link to activate your account:', $siteTitle) . "\n\n" . WEB_ROOT . "/admin/users/activate?u={$ua->url}\n\n" . __('%s Administrator', $siteTitle);
     $subject = __('Activate your account with the %s repository', $siteTitle);
     $mail = new Zend_Mail('UTF-8');
     $mail->setBodyText($body);
     $mail->setFrom('*****@*****.**', "Archives départementales 35");
     $mail->addTo($user->email, $user->name);
     $mail->setSubject($subject);
     $mail->addHeader('X-Mailer', 'PHP/' . phpversion());
     try {
         $mail->send();
         return true;
     } catch (Zend_Mail_Transport_Exception $e) {
         $logger = $this->getInvokeArg('bootstrap')->getResource('Logger');
         if ($logger) {
             $logger->log($e, Zend_Log::ERR);
         }
         return false;
     }
 }
예제 #28
0
 protected function _sendEmail(array $user, array $email, Zend_Mail_Transport_Abstract $transport)
 {
     if (!$user['email']) {
         return false;
     }
     if (!XenForo_Application::get('config')->enableMail) {
         return true;
     }
     $options = XenForo_Application::getOptions();
     XenForo_Db::ping();
     $mailObj = new Zend_Mail('utf-8');
     $mailObj->setSubject($email['email_title'])->addTo($user['email'], $user['username'])->setFrom($email['from_email'], $email['from_name']);
     $bounceEmailAddress = $options->bounceEmailAddress;
     if (!$bounceEmailAddress) {
         $bounceEmailAddress = $options->defaultEmailAddress;
     }
     $toEmail = $user['email'];
     $bounceHmac = substr(hash_hmac('md5', $toEmail, XenForo_Application::getConfig()->globalSalt), 0, 8);
     $mailObj->addHeader('X-To-Validate', "{$bounceHmac}+{$toEmail}");
     if ($options->enableVerp) {
         $verpValue = str_replace('@', '=', $toEmail);
         $bounceEmailAddress = str_replace('@', "+{$bounceHmac}+{$verpValue}@", $bounceEmailAddress);
     }
     $mailObj->setReturnPath($bounceEmailAddress);
     if ($email['email_format'] == 'html') {
         $replacements = array('{name}' => htmlspecialchars($user['username']), '{email}' => htmlspecialchars($user['email']), '{id}' => $user['user_id']);
         $email['email_body'] = strtr($email['email_body'], $replacements);
         $text = trim(htmlspecialchars_decode(strip_tags($email['email_body'])));
         $mailObj->setBodyHtml($email['email_body'])->setBodyText($text);
     } else {
         $replacements = array('{name}' => $user['username'], '{email}' => $user['email'], '{id}' => $user['user_id']);
         $email['email_body'] = strtr($email['email_body'], $replacements);
         $mailObj->setBodyText($email['email_body']);
     }
     if (!$mailObj->getMessageId()) {
         $mailObj->setMessageId();
     }
     $thisTransport = XenForo_Mail::getFinalTransportForMail($mailObj, $transport);
     try {
         $mailObj->send($thisTransport);
     } catch (Exception $e) {
         XenForo_Error::logException($e, false, "Email to {$user['email']} failed: ");
         return false;
     }
     return true;
 }
예제 #29
0
 /**
  * Check if Header Fields are stripped accordingly in sendmail transport;
  * also check for header injection
  */
 public function testHeaderEncoding2()
 {
     $mail = new Zend_Mail();
     $mail->setBodyText('My Nice Test Text');
     // try header injection:
     $mail->addTo("testmail@example.com\nCc:foobar@example.com");
     $mail->addHeader('X-MyTest', "Test\nCc:foobar2@example.com", true);
     // try special Chars in Header Fields:
     $mail->setFrom('*****@*****.**', 'äüößÄÖÜ');
     $mail->addTo('*****@*****.**', 'äüößÄÖÜ');
     $mail->addCc('*****@*****.**', 'äüößÄÖÜ');
     $mail->setSubject('äüößÄÖÜ');
     $mail->addHeader('X-MyTest', 'Test-äüößÄÖÜ', true);
     $mock = new Zend_Mail_Transport_Sendmail_Mock();
     $mail->send($mock);
     $this->assertTrue($mock->called);
     $this->assertContains('From: =?iso-8859-1?Q?"=E4=FC=F6=DF=C4=D6=DC"?=', $mock->header);
     $this->assertNotContains("\nCc:foobar@example.com", $mock->header);
     $this->assertContains('Cc: =?iso-8859-1?Q?"=E4=FC=F6=DF=C4=D6=DC"=20?=<*****@*****.**>', $mock->header);
     $this->assertContains('X-MyTest:', $mock->header);
     $this->assertNotContains("\nCc:foobar2@example.com", $mock->header);
     $this->assertContains('=?iso-8859-1?Q?Test-=E4=FC=F6=DF=C4=D6=DC?=', $mock->header);
     $this->assertNotContains('Subject: ', $mock->header);
     $this->assertContains('=?iso-8859-1?Q?=E4=FC=F6=DF=C4=D6=DC?=', $mock->subject);
     $this->assertContains('=?iso-8859-1?Q?"=E4=FC=F6=DF=C4=D6=DC"=20?=<*****@*****.**>', $mock->recipients);
 }
예제 #30
0
 private function _sendMadeActiveEmail($record)
 {
     $email = $record->email;
     $name = $record->name;
     $siteTitle = get_option('site_title');
     $subject = __("Your %s account", $siteTitle);
     $body = "<p>";
     $body .= __("An admin has made your account on %s active. You can now log in to with your password at this link:", $siteTitle);
     $body .= "</p>";
     $body .= "<p><a href='" . WEB_ROOT . "/users/login'>{$siteTitle}</a></p>";
     $from = get_option('administrator_email');
     $mail = new Zend_Mail('UTF-8');
     $mail->setBodyHtml($body);
     $mail->setFrom($from, "{$siteTitle} Administrator");
     $mail->addTo($email, $name);
     $mail->setSubject($subject);
     $mail->addHeader('X-Mailer', 'PHP/' . phpversion());
     $mail->send();
 }