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


PHP Zend_Mail::setFrom方法代码示例

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


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

示例1: send

 /**
  * sends a standard email
  * 
  * @param string $subject
  * @param string $toName
  * @param array $toEmails
  * @param array $emailOptions
  * @param string $fromName
  * @param string $fromEmail
  */
 public function send($subject, $toName, $toEmails = array(), $emailOptions = array(), $fromName = null, $fromEmail = null)
 {
     $logger = Zend_Registry::get('logger');
     $config = vkNgine_Config::getSystemConfig()->mail;
     if ($config->serverType == 'smtp') {
         $tr = new Zend_Mail_Transport_Smtp($config->server, $config->toArray());
     }
     Zend_Mail::setDefaultTransport($tr);
     foreach ($toEmails as $email) {
         $mail = new Zend_Mail();
         if ($emailOptions['type'] == 'html') {
             $mail->setBodyHtml($emailOptions['email']);
         } else {
             $mail->setBodyText($emailOptions['email']);
         }
         if (!$fromName || !$fromEmail) {
             $mail->setFrom($config->noreply, 'GYM Tracker');
         } else {
             $mail->setFrom($fromEmail, $fromName);
         }
         $mail->addTo($email, $toName);
         $mail->setSubject($subject);
         try {
             $mail->send();
         } catch (Zend_Mail_Protocol_Exception $e) {
             $logger->log('MESSAGE_SEND_FAILED', 'Unable to send to ' . $email . ' - ' . $e->getMessage(), 1);
         }
     }
 }
开发者ID:AlexanderMazaletskiy,项目名称:gym-Tracker-App,代码行数:39,代码来源:Email.php

示例2: notifyCustomerOfDelivery

 /**
  * Notifies the customer of their delivery.
  *
  * @param \IocExample\Model\Customer $customer
  * @param \IocExample\Model\Order $order
  * @return void
  */
 public function notifyCustomerOfDelivery(Customer $customer, Order $order)
 {
     $this->_mailer->setFrom('orders@chrisweldon.net', 'Grumpy Baby Orders');
     $this->_mailer->setSubject('Order #' . $order->getId() . ' out for Delivery');
     $this->_mailer->setBodyText('Your order is being shipped!');
     $this->_mailer->addTo($customer->getEmail(), $customer->getName());
     $this->_mailer->send();
 }
开发者ID:neraath,项目名称:ioc-php-talk,代码行数:15,代码来源:EmailNotifier.php

示例3: __construct

 /**
  *
  * @param Zend_Controller_Request_Abstract$request
  * @param Zend_Mail|null $mailer
  * @param string|null $to
  */
 public function __construct($request, $config, $mailer = NULL)
 {
     $this->_request = $request;
     if (isset($mailer)) {
         $this->_mailer = $mailer;
     } else {
         $this->_mailer = new Zend_Mail('UTF-8');
     }
     $this->_mailer->addTo($config->contactEmail);
     if (!empty($config->fromEmail)) {
         $this->_mailer->setFrom($config->fromEmail);
     }
 }
开发者ID:jbazant,项目名称:mtgim,代码行数:19,代码来源:Contact.php

示例4: send

 /**
  * load the template and send the message
  *
  * @param string $recipient
  * @param array $from
  * @param string $subject
  * @param string $template
  * @param array $data
  * @param string $cc
  * @return bool
  */
 public function send($recipient, $from = array(), $subject, $message, $cc = false)
 {
     $config = Zend_Registry::get('config');
     $this->_view->addScriptPath($config->filepath->emailTemplates);
     $this->_view->emailBody = $message;
     $this->_mail->setBodyHtml($this->_view->render('template.phtml'));
     $this->_mail->setFrom($from[0], $from[1]);
     $this->_mail->addTo($recipient);
     if ($cc) {
         $this->_mail->addCc($cc);
     }
     $this->_mail->setSubject($subject);
     return $this->_mail->send($this->_transport);
 }
开发者ID:laiello,项目名称:digitalus-cms,代码行数:25,代码来源:Mail.php

示例5: actionIndex

 public function actionIndex()
 {
     require_once 'Zend/Mail.php';
     $sql = "SELECT * FROM client where (cli_saleemail = 'yes' or cli_letemail  = 'yes') and cli_email != '' and cli_email is not null";
     $data = Yii::app()->db->createCommand($sql)->queryAll();
     $exclude = [];
     if (file_exists('luna/exclude')) {
         $exclude = file('luna/exclude');
     }
     foreach ($data as $client) {
         if (in_array($client['cli_email'], $exclude)) {
             $this->log('excluded ' . $client['cli_email']);
             continue;
         }
         try {
             $mail = new Zend_Mail("UTF-8");
             $mail->addTo($client['cli_email']);
             $mail->setFrom('admin@woosterstock.co.uk');
             $mail->setSubject('Win 2 tickets to the Luna Outdoor Cinema');
             $mail->setBodyHtml($this->renderFile(Yii::getPathOfAlias('application.commands.luna') . '/template.php', compact('client'), true));
             $this->log('Sending mail to ' . $client['cli_fname'] . ' [' . $client['cli_email'] . ']');
             $mail->send();
             $this->log('Mail sent to ' . $client['cli_fname'] . ' [' . $client['cli_email'] . ']');
         } catch (Exception $e) {
             $this->log('ERROR : Mail NOT sent to ' . $client['cli_fname'] . ' [' . $client['cli_email'] . ']');
         }
     }
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:28,代码来源:LunaCinemaCommand.php

示例6: init

 public function init()
 {
     $this->model = new ContactUsForm();
     if (isset($_POST['ContactUsForm'])) {
         $this->model->attributes = $_POST['ContactUsForm'];
         if ($this->model->validate()) {
             $this->successMessage = 'Your message has been sent, thank you';
             try {
                 include_once "Zend/Mail.php";
                 $contactName = strip_tags($this->model->name);
                 $staffMessage = "Name:\t" . $contactName . "\n" . "Tel:\t" . $this->model->telephone . "\n" . "Email:\t" . $this->model->email . "\n" . "Message:\n" . $this->model->message . "\n\n" . "Sent:\t" . date("d/m/Y H:i");
                 $mailToStaff = new Zend_Mail("UTF-8");
                 $mailToStaff->addTo($this->model->to . Yii::app()->params['contactUs']['email_hostname']);
                 $mailToStaff->setFrom($this->model->to . Yii::app()->params['contactUs']['email_hostname']);
                 $mailToStaff->setSubject("Message posted from Wooster & Stock Contact Page");
                 $mailToStaff->setBodyText($staffMessage);
                 $mailToStaff->send();
                 $mailToClient = new Zend_Mail('UTF-8');
                 $mailToClient->addTo($this->model->email, $contactName);
                 $mailToClient->setFrom($this->model->to . Yii::app()->params['contactUs']['email_hostname']);
                 $mailToClient->setSubject("Message posted from Wooster & Stock Contact Page");
                 $mailToClient->setBodyText($this->emailText('text', $this->model->email, $contactName));
                 $mailToClient->setBodyHtml($this->emailText('html', $this->model->email, $contactName));
                 $mailToClient->send();
             } catch (Exception $e) {
             }
             $this->model->unsetAttributes();
         }
     }
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:30,代码来源:ContactUs.php

示例7: sendStatusEmail

 public function sendStatusEmail()
 {
     $vBody = '';
     $aSuccess = $this->getSuccess();
     if (count($aSuccess) > 0) {
         $vBody .= "The following completed successfully:\n * " . implode("\n * ", $aSuccess) . "\n\n";
     }
     $aErrors = $this->getErrors();
     if (count($aErrors) > 0) {
         $vBody .= "The following errors occurred (feed - sku - error):\n";
         foreach ($aErrors as $aError) {
             $vBody .= $aError['feed'] . ' - ' . $aError['sku'] . ' - ' . $aError['message'] . "\n";
         }
     }
     if ($vBody !== '') {
         $aTo = Mage::getStoreConfig(self::CONFIG_EMAIL_TO_ADDRESS);
         if ($aTo == '') {
             return $this;
         } else {
             $aTo = explode(',', $aTo);
         }
         $mail = new Zend_Mail();
         $mail->setFrom(Mage::getStoreConfig(self::CONFIG_EMAIL_FROM_ADDRESS), Mage::getStoreConfig(self::CONFIG_EMAIL_FROM_NAME));
         $mail->addTo($aTo);
         $mail->setSubject("Feed Export Status Report");
         $mail->setBodyText($vBody);
         $mail->send();
     }
 }
开发者ID:ernandes-xeo,项目名称:Aligent_Feeds,代码行数:29,代码来源:Status.php

示例8: getMail

    /**
     * @return Zend_Mail
     * @throws Zend_Mail_Protocol_Exception
     */
    public static function getMail($name, $email, $feedback)
    {
        // can't use $this-_config 'cause it's a static function
        $configEmail = Zend_Registry::get('config')->email;
        switch (strtolower($configEmail->transport)) {
            case 'smtp':
                Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Smtp($configEmail->host, $configEmail->toArray()));
                break;
            case 'mock':
                Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Mock());
                break;
            default:
                Zend_Mail::setDefaultTransport(new Zend_Mail_Transport_Sendmail());
        }
        $mail = new Zend_Mail('UTF-8');
        $mail->setBodyText(<<<EOD
Dear Administrator,

The community-id feedback form has just been used to send you the following:

Name: {$name}
E-mail: {$email}
Feedback:
{$feedback}
EOD
);
        $mail->setFrom($configEmail->supportemail);
        $mail->addTo($configEmail->supportemail);
        $mail->setSubject('Community-ID feedback form');
        return $mail;
    }
开发者ID:sdgdsffdsfff,项目名称:auth-center,代码行数:35,代码来源:FeedbackController.php

示例9: userRecovery

 /**
  * 
  * @param User_Form_Recovery $form
  * @return boolean
  */
 public function userRecovery(User_Form_Recovery $form)
 {
     $answer = false;
     $user = Doctrine_Query::create()->from('User_Model_Mapper_User u')->select('u.username')->addSelect('u.password')->where('u.username = ?', $form->getValue('username'));
     if ($user->count() != '0') {
         $userRecovery = $user->fetchOne();
         $ranges = array(range('a', 'z'), range('A', 'Z'), range(1, 9));
         $length = 8;
         $pass = '';
         for ($i = 0; $i < $length; $i++) {
             $rkey = array_rand($ranges);
             $vkey = array_rand($ranges[$rkey]);
             $pass .= $ranges[$rkey][$vkey];
         }
         $hash = sha1($pass);
         $userRecovery->password = $hash;
         $userRecovery->save();
         $mail = new Zend_Mail();
         $mail->setBodyHtml('<p>Your new password.</p><p>Password: ' . $pass . '</p>');
         $mail->setFrom('punk1213@yandex.com', 'Administrator');
         $mail->addTo($userRecovery->email, $userRecovery->username);
         $mail->setSubject('Test password recovery');
         $mail->send();
         $answer = true;
     }
     return $answer;
 }
开发者ID:vbryan,项目名称:Zend,代码行数:32,代码来源:UserRegistration.php

示例10: sendEmail

 public function sendEmail($template, $to, $subject, $params = array())
 {
     try {
         $config = array('auth' => 'Login', 'port' => $this->_bootstrap_options['mail']['port'], 'ssl' => 'ssl', 'username' => $this->_bootstrap_options['mail']['username'], 'password' => $this->_bootstrap_options['mail']['password']);
         $tr = new Zend_Mail_Transport_Smtp($this->_bootstrap_options['mail']['server'], $config);
         Zend_Mail::setDefaultTransport($tr);
         $mail = new Zend_Mail('UTF-8');
         $layout = new Zend_Layout();
         $layout->setLayoutPath($this->_bootstrap_options['mail']['layout']);
         $layout->setLayout('email');
         $view = $layout->getView();
         $view->domain_url = $this->_bootstrap_options['site']['domainurl'];
         $view = new Zend_View();
         $view->params = $params;
         $view->setScriptPath($this->_bootstrap_options['mail']['view_script']);
         $layout->content = $view->render($template . '.phtml');
         $content = $layout->render();
         $mail->setBodyText(preg_replace('/<[^>]+>/', '', $content));
         $mail->setBodyHtml($content);
         $mail->setFrom($this->_bootstrap_options['mail']['from'], $this->_bootstrap_options['mail']['from_name']);
         $mail->addTo($to);
         $mail->setSubject($subject);
         $mail->send();
     } catch (Exception $e) {
         // 这里要完善
     }
     return true;
 }
开发者ID:ud223,项目名称:yj,代码行数:28,代码来源:Email.php

示例11: _sendEmail

 protected function _sendEmail($history)
 {
     ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
     ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
     $mail = new Zend_Mail('utf-8');
     $mail->addTo($history->getEmail());
     $mail->setBodyHTML($history->getBody());
     $mail->setSubject('=?utf-8?B?' . base64_encode($history->getSubject()) . '?=');
     $senderName = Mage::getStoreConfig(self::NAME_XML_PATH, $history->getStoreId());
     //Mage::getStoreConfig('trans_email/ident_general/name');
     $senderEmail = Mage::getStoreConfig(self::EMAIL_XML_PATH, $history->getStoreId());
     //Mage::getStoreConfig('trans_email/ident_general/email');
     $cc = Mage::getStoreConfig(self::CC_XML_PATH, $history->getStoreId());
     $mail->addCc($cc);
     $mail->setFrom($senderEmail, $senderName);
     try {
         if ((string) Mage::getConfig()->getNode('modules/Aschroder_SMTPPro/active') == 'true') {
             $transport = Mage::helper('smtppro')->getTransport();
             $mail->send($transport);
         } else {
             $mail->send();
         }
     } catch (Exception $e) {
         Mage::logException($e);
         return false;
     }
     return true;
 }
开发者ID:ankita-parashar,项目名称:magento,代码行数:28,代码来源:Amasty_Acart_Model_Schedule.php

示例12: apkisgeneratedAction

 public function apkisgeneratedAction()
 {
     $appName = $this->getRequest()->getParam('app_name');
     $apk_base_path = Core_Model_Directory::getBasePathTo("var/tmp/applications/android/{$appName}/Siberian/app/build/outputs/apk/app-release.apk");
     $apk_path = Core_Model_Directory::getPathTo("var/tmp/applications/android/{$appName}/Siberian/app/build/outputs/apk/app-release.apk");
     $apk_is_generated = false;
     $link = $this->getUrl() . $apk_path;
     $link = str_replace("//", "/", $link);
     if (file_exists($apk_base_path)) {
         if (time() - filemtime($apk_base_path) <= 600) {
             $apk_is_generated = true;
         }
     }
     $user = new Backoffice_Model_User();
     try {
         $user = $user->findAll(null, "user_id ASC", array("limit" => "1"))->current();
         $sender = System_Model_Config::getValueFor("support_email");
         $support_name = System_Model_Config::getValueFor("support_name");
         $layout = $this->getLayout()->loadEmail('application', 'download_source');
         $subject = $this->_('Android APK Generation');
         $layout->getPartial('content_email')->setLink($link);
         $layout->getPartial('content_email')->setApkStatus($apk_is_generated);
         $content = $layout->render();
         $mail = new Zend_Mail('UTF-8');
         $mail->setBodyHtml($content);
         $mail->setFrom($sender, $support_name);
         $mail->addTo($user->getEmail());
         $mail->setSubject($subject);
         $mail->send();
     } catch (Exception $e) {
         $logger = Zend_Registry::get("logger");
         $logger->sendException("Fatal Error Sending the APK Generation Email: \n" . print_r($e, true), "apk_generation_");
     }
     die('ok');
 }
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:35,代码来源:DeviceController.php

示例13: sendAction

 /**
  * Action send.
  *
  * @return void
  */
 public function sendAction()
 {
     $form = new Application_Form_Forgot();
     $tableUser = new Tri_Db_Table('user');
     $data = $this->_getAllParams();
     if ($form->isValid($data)) {
         $email = $this->_getParam('email');
         $user = $tableUser->fetchRow(array('email = ?' => $email));
         if (!$user->id) {
             $this->_helper->_flashMessenger->addMessage('user not avaliable');
             $this->_redirect('forgot/');
         }
         $this->view->name = $user->name;
         $this->view->url = $this->encryptUrl($user);
         $mail = new Zend_Mail(APP_CHARSET);
         $mail->setBodyHtml($this->view->render('forgot/mail.phtml'));
         $mail->setFrom(FROM_EMAIL, FROM_NAME);
         $mail->setSubject($this->view->translate('forgot'));
         $mail->addTo($user->email, $user->name);
         $mail->send();
         $this->_helper->_flashMessenger->addMessage('Success');
         $this->_redirect('forgot/');
     }
     $this->_helper->_flashMessenger->addMessage('Error');
     $this->_redirect('forgot/');
 }
开发者ID:ramonornela,项目名称:trilhas,代码行数:31,代码来源:ForgotController.php

示例14: run

 /**
  *  Send mail.
  *
  *  @access     public
  *  @param      object      $workload       Object with mail sender, receiver, subject and body
  *  @return     void
  *  @throws     InvalidArgumentException    if workload object has no sender
  *  @throws     InvalidArgumentException    if workload object has no receiver
  *  @throws     InvalidArgumentException    if workload object has no subject
  *  @throws     InvalidArgumentException    if workload object has no body
  */
 public function run($workload)
 {
     $smtpServer = $this->options['server'];
     $config = array();
     if ($this->options['auth']) {
         $config['auth'] = $this->options['auth'];
         $config['username'] = $this->options['username'];
         $config['password'] = $this->options['password'];
     }
     $transport = new Zend_Mail_Transport_Smtp($smtpServer, $config);
     if (is_object($workload)) {
         if (empty($workload->sender)) {
             throw new InvalidArgumentException('Workload is missing sender');
         }
         if (empty($workload->receiver)) {
             throw new InvalidArgumentException('Workload is missing receiver');
         }
         if (empty($workload->subject)) {
             throw new InvalidArgumentException('Workload is missing subject');
         }
         if (empty($workload->body)) {
             throw new InvalidArgumentException('Workload is missing body');
         }
         $mail = new Zend_Mail();
         $mail->setDefaultTransport($transport);
         $mail->addTo($workload->receiver);
         $mail->setSubject($workload->subject);
         $mail->setBodyText($workload->body);
         $mail->setFrom($workload->sender);
         $mail->send($transport);
         $this->logSuccess('Mail "' . $workload->subject . '" sent to ' . $workload->receiver);
     }
 }
开发者ID:dmj,项目名称:uni-helmstedt.hab.de,代码行数:44,代码来源:Mail.php

示例15: errorAction

 public function errorAction()
 {
     $this->view->headTitle(' - Error ', 'APPEND');
     $this->view->exception = $this->_getParam('error_handler')->exception;
     switch (get_class($this->view->exception)) {
         case 'Zend_Controller_Router_Exception':
             $this->getResponse()->setHttpResponseCode(404);
             break;
         default:
             $this->getResponse()->setHttpResponseCode(500);
             break;
     }
     $this->view->headLink()->appendStylesheet('/css/error/error.css');
     if (APPLICATION_ENVIRONMENT == 'production' && get_class($this->view->exception) != 'Zend_Controller_Router_Exception') {
         // mail the error to neil@yadda.co.za
         $mail = new Zend_Mail('utf-8');
         $mail->setFrom('no-reply@yadda.co.za', 'yadda.');
         $mail->setSubject('Exception at ' . $_SERVER['REQUEST_URI']);
         $mail->addTo('neil@yadda.co.za');
         ob_start();
         var_dump($this->view->exception);
         echo "\n\n";
         var_dump($_SERVER);
         $mail->setBodyText(ob_get_clean());
         try {
             $mail->send();
         } catch (Exception $e) {
             // ignore
         }
     }
 }
开发者ID:neilgarb,项目名称:yadda,代码行数:31,代码来源:ErrorController.php


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