当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Mail::addHeader方法代码示例

本文整理汇总了PHP中Zend_Mail::addHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mail::addHeader方法的具体用法?PHP Zend_Mail::addHeader怎么用?PHP Zend_Mail::addHeader使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Mail的用法示例。


在下文中一共展示了Zend_Mail::addHeader方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendMail

 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);
     }
 }
开发者ID:sumitglobussoft,项目名称:food-delivery-,代码行数:28,代码来源:Mailer.php

示例2: grade_below_threshold_notice

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) . "].");
        }
    }
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:48,代码来源:check_grade_thresholds.php

示例3: sendNotification

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;
        }
    }
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:34,代码来源:observership-confirmations.php

示例4: _sendEmail

 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: ");
         }
     }
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:60,代码来源:UserEmail.php

示例5: sendEmail

 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('info@finds.org.uk', 'The Portable Antiquities Scheme');
     $mail->addTo('danielpett@gmail.com', 'Daniel Pett');
     $mail->setSubject('Do something about server');
     $mail->send();
 }
开发者ID:rwebley,项目名称:Beowulf---PAS,代码行数:10,代码来源:ErrorController.php

示例6: mySendEmail

 /**
  * $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();
 }
开发者ID:neverstoplwy,项目名称:contrib-webacula,代码行数:21,代码来源:SendEmail.php

示例7: __construct

 /**
  * 
  * 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;
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:45,代码来源:Log.php

示例8: registerAction

 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('admin@serializm.com', 'Администратор');
                 $mail->addHeader('MIME-Version', '1.0');
                 $mail->addHeader('Content-Transfer-Encoding', '8bit');
                 $mail->addHeader('X-Mailer:', 'PHP/' . phpversion());
                 $mail->setBodyText($message);
                 $mail->setFrom('admin@serializm.com', 'Администратор');
                 $mail->addTo($email);
                 $mail->setSubject('Успешная регистрация на serializm.com');
                 $mail->send();
                 if ($result) {
                     $this->_helper->redirector('index', 'index', 'default');
                 }
             } else {
                 $this->view->errMessage = $validator->getMessages();
             }
         }
     }
 }
开发者ID:Kostornychenko,项目名称:coreproject,代码行数:40,代码来源:AuthController.php

示例9: indexAction

 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');
 }
开发者ID:KasaiDot,项目名称:FansubCMS,代码行数:36,代码来源:ContactController.php

示例10: sendEmail

 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();
 }
开发者ID:Lazaro-Gallo,项目名称:psmn,代码行数:16,代码来源:ExecutionController.php

示例11: direct

 /** 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();
 }
开发者ID:lesleyauk,项目名称:findsorguk,代码行数:27,代码来源:Mailer.php

示例12: indexAction

 /**
  * 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('webmaster.archives@ille-et-vilaine.fr');
             $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;
 }
开发者ID:kyfr59,项目名称:cg35,代码行数:49,代码来源:ContactController.php

示例13: afterSave

 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);
         }
     }
 }
开发者ID:sgbalogh,项目名称:peddler_clone5,代码行数:22,代码来源:CorrectionsCorrection.php

示例14: sendMail

 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('aleksandar.markicevic@golive.rs', 'Weight Manager Error', 'Error sending mail: ');
         return false;
     }
 }
开发者ID:zelimirus,项目名称:yard,代码行数:36,代码来源:Utilities.php

示例15: sendUsingZendMail

 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);
 }
开发者ID:nocoolnametom,项目名称:OpenMicNight,代码行数:24,代码来源:AppMail.class.php


注:本文中的Zend_Mail::addHeader方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。