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


PHP Zend_Mail::setDefaultFrom方法代码示例

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


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

示例1: _initMail

 protected function _initMail()
 {
     Zend_Mail::setDefaultFrom('xlr8ufitness@live.com.au', 'XLR8U Fitness');
     Zend_Mail::setDefaultReplyTo('xlr8ufitness@live.com.au', 'XLR8U Fitness');
     $transport = new Zend_Mail_Transport_Sendmail();
     Zend_Mail::setDefaultTransport($transport);
 }
开发者ID:robjacoby,项目名称:xlr8u,代码行数:7,代码来源:Bootstrap.php

示例2: __construct

 public function __construct($scriptName, $day = null)
 {
     if ($day != null) {
         $this->_day = $day;
     }
     $this->_scriptName = $scriptName;
     $this->_config = Zend_Registry::get('config');
     # init $this->_texts
     $this->_texts = new stdClass();
     $smtp_cfg = array('auth' => $this->_config->mail->auth, 'username' => $this->_config->mail->username, 'password' => $this->_config->mail->password);
     // echo 'auth: '. var_dump($this->_config->mail->auth);
     // echo 'username: '. var_dump($this->_config->mail->username);
     // echo 'password: '. var_dump($this->_config->mail->password);
     // exit;
     //
     // $smtp_cfg = array('auth' => 'login',
     //                 'username' => 'alex.chien@koocaa.com',
     //                 'password' => 'alexgemalexgem');
     $transport = new Zend_Mail_Transport_Smtp($this->_config->mail->smtp, $smtp_cfg);
     Zend_Mail::setDefaultTransport($transport);
     Zend_Mail::setDefaultFrom($this->_config->mail->addressFrom, $this->_config->mail->labelFrom);
     $langs = Zend_Registry::get('db')->fetchCol('SELECT DISTINCT(`lang`) FROM `user`');
     foreach ($langs as $lang) {
         $file = APPLICATION_PATH . '/configs/langs/' . $lang . '/emails.ini';
         $this->_texts->{$lang} = new Zend_Config_Ini($file, $this->_scriptName);
     }
 }
开发者ID:AlexChien,项目名称:bbcoach,代码行数:27,代码来源:Massmailer.php

示例3: __construct

 public function __construct()
 {
     $tr = new Zend_Mail_Transport_Smtp(Zend_Registry::get('Setting')->EMAIL_SMTP_HOST, array('auth' => 'login', 'username' => Zend_Registry::get('Setting')->EMAIL_SMTP_USER, 'password' => Zend_Registry::get('Setting')->EMAIL_SMTP_PASS, 'port' => Zend_Registry::get('Setting')->EMAIL_SMTP_PORT));
     if (Zend_Registry::get('Setting')->EMAIL_SMTP_SSL) {
         array('ssl' => Zend_Registry::get('Setting')->EMAIL_SMTP_SSL);
     }
     Zend_Mail::setDefaultTransport($tr);
     Zend_Mail::setDefaultFrom(Zend_Registry::get('Setting')->webmaster_email, Zend_Registry::get('Setting')->webmaster_name);
     Zend_Mail::setDefaultReplyTo(Zend_Registry::get('Setting')->webmaster_email, Zend_Registry::get('Setting')->webmaster_name);
 }
开发者ID:hoaitn,项目名称:base-zend,代码行数:10,代码来源:Email.php

示例4: _initMail

 protected function _initMail()
 {
     $mailOption = $this->getOption('resources');
     $mailOption = $mailOption['mail'];
     $host = $mailOption['host'];
     $mailOption = $mailOption['info'];
     $transport = new Zend_Mail_Transport_Smtp($host, $mailOption);
     //Zend_Debug::dump($transport);die;
     Zend_Registry::set('mailTransport', $transport);
     Zend_Mail::setDefaultTransport($transport);
     Zend_Mail::setDefaultFrom(EMAIL_SUPPORT);
 }
开发者ID:backviet01,项目名称:zegome-service,代码行数:12,代码来源:Bootstrap.php

示例5: sendEmail

 public function sendEmail($message)
 {
     $config = array('auth' => 'login', 'username' => 'AKIAJJW5TG53CLR72RQA', 'password' => 'AgJ7wBiuHZ1bLn1sUKr15/NUf/X+1ceN4cTatAVYFOxA', 'ssl' => 'tls', 'port' => 587);
     $transport = new Zend_Mail_Transport_Smtp('email-smtp.us-east-1.amazonaws.com', $config);
     Zend_Mail::setDefaultFrom('info@tur8.ru');
     Zend_Mail::setDefaultTransport($transport);
     $mail = new Zend_Mail();
     $mail->setBodyHtml($message, 'utf-8');
     $mail->addTo("it@itiru.ru");
     try {
         $mail->send();
     } catch (Zend_Mail_Exception $e) {
         return $e->getMessage();
     }
     return true;
 }
开发者ID:MichaelGogeshvili,项目名称:strap,代码行数:16,代码来源:Logs.php

示例6: getInstance

 /**
  * Configures and fetches a singleton instance of `Zend_Mail`.
  * Also clears settings from previous use onthe `Zend_Mail` object
  * unless you call `getInstance(false)`.
  */
 public static function getInstance($clear = true)
 {
     // Has it been requested before?
     if (self::$mailer === null) {
         // Parse/verify configuration file
         self::$config = conf('Mailer');
         // Create the new Zend_Mail object
         self::$mailer = new Zend_Mail('UTF-8');
         // Set the transport method
         if (!isset(self::$config['transport']) || !isset(self::$config['transport']['type'])) {
             self::$error = 'No transport method defined.';
             return false;
         }
         switch (self::$config['transport']['type']) {
             case 'smtp':
                 $config = self::$config['transport'];
                 $host = $config['host'];
                 unset($config['host']);
                 unset($config['type']);
                 require_once 'Zend/Mail/Transport/Smtp.php';
                 self::$transport = new Zend_Mail_Transport_Smtp($host, $config);
                 break;
             case 'sendmail':
                 require_once 'Zend/Mail/Transport/Sendmail.php';
                 self::$transport = new Zend_Mail_Transport_Sendmail();
                 break;
             case 'file':
                 if (!isset(self::$config['transport']['path'])) {
                     self::$config['transport']['path'] = 'cache/mailer';
                 }
                 if (!file_exists(self::$config['transport']['path'])) {
                     mkdir(self::$config['transport']['path']);
                 }
                 require_once 'Zend/Mail/Transport/File.php';
                 self::$transport = new Zend_Mail_Transport_File(array('path' => self::$config['transport']['path'], 'callback' => function ($transport) {
                     // Files are named DATETIME-RECIPIENT-RAND.tmp
                     return $_SERVER['REQUEST_TIME'] . '-' . $transport->recipients . '-' . mt_rand() . '.tmp';
                 }));
                 break;
             default:
                 self::$error = 'Unknown transport type.';
                 return false;
         }
         Zend_Mail::setDefaultTransport(self::$transport);
         // Set default from info
         $email_from = self::$config['email_from'] !== 'default' ? self::$config['email_from'] : conf('General', 'email_from');
         $email_name = self::$config['email_name'] !== 'default' ? self::$config['email_name'] : conf('General', 'site_name');
         Zend_Mail::setDefaultFrom($email_from, $email_name);
     }
     // Clear mailer settings
     if ($clear) {
         self::$mailer->clearRecipients();
         self::$mailer->clearSubject();
         self::$mailer->clearFrom();
     }
     return self::$mailer;
 }
开发者ID:nathanieltite,项目名称:elefant,代码行数:62,代码来源:Mailer.php

示例7: _getFallBackTransport

 /**
  * Get the fallback Transport, used if the plugin is disabled
  * @return Zend_Mail_Transport_Sendmail
  */
 protected function _getFallBackTransport($parameters = null)
 {
     Zend_Mail::setDefaultFrom($this->settings->siteEmail);
     Zend_Mail::setDefaultReplyTo($this->settings->siteEmail, $this->seoOption->siteName);
     return new Zend_Mail_Transport_Sendmail($parameters);
 }
开发者ID:sandeepdwarkapuria,项目名称:dotkernel,代码行数:10,代码来源:Email.php

示例8: testVerifyDefaults

 public function testVerifyDefaults()
 {
     Zend_Mail::setDefaultFrom('foobar@example.org');
     $mail = $this->getGeneratedEmail(array('addresses' => 'foo@example.org'));
     $this->assertEquals('foobar@example.org', $mail->getFrom());
     $this->assertStringStartsWith('Errors in project', $mail->getSubject());
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:7,代码来源:MailTest.php

示例9: init

 /**
  * Initializes the mailer with the settings form Settings -> System -> Email Settings
  *
  * @return void
  */
 public function init($type = "email")
 {
     $systemConfig = \Pimcore\Config::getSystemConfig()->toArray();
     $emailSettings =& $systemConfig[$type];
     if ($emailSettings['sender']['email']) {
         \Zend_Mail::setDefaultFrom($emailSettings['sender']['email'], $emailSettings['sender']['name']);
     }
     if ($emailSettings['return']['email']) {
         \Zend_Mail::setDefaultReplyTo($emailSettings['return']['email'], $emailSettings['return']['name']);
     }
     if ($emailSettings['method'] == "smtp") {
         $config = array();
         if ($emailSettings['smtp']['name']) {
             $config['name'] = $emailSettings['smtp']['name'];
         }
         if ($emailSettings['smtp']['ssl']) {
             $config['ssl'] = $emailSettings['smtp']['ssl'];
         }
         if ($emailSettings['smtp']['port']) {
             $config['port'] = $emailSettings['smtp']['port'];
         }
         if ($emailSettings['smtp']['auth']['method']) {
             $config['auth'] = $emailSettings['smtp']['auth']['method'];
             $config['username'] = $emailSettings['smtp']['auth']['username'];
             $config['password'] = $emailSettings['smtp']['auth']['password'];
         }
         $transport = new \Zend_Mail_Transport_Smtp($emailSettings['smtp']['host'], $config);
         \Zend_Mail::setDefaultTransport($transport);
     }
     //setting debug email addresses
     if ($type == "email" && empty(self::$debugEmailAddresses)) {
         if ($emailSettings['debug']['emailaddresses']) {
             foreach (explode(',', $emailSettings['debug']['emailaddresses']) as $emailAddress) {
                 self::$debugEmailAddresses[] = $emailAddress;
             }
         }
     }
     $this->placeholderObject = new \Pimcore\Placeholder();
 }
开发者ID:emanuel-london,项目名称:pimcore,代码行数:44,代码来源:Mail.php

示例10: testMethodSendUsesDefaults

 public function testMethodSendUsesDefaults()
 {
     Zend_Mail::setDefaultFrom('john@example.com', 'John Doe');
     Zend_Mail::setDefaultReplyTo('foo@example.com', 'Foo Bar');
     $mail = new Zend_Mail();
     $mail->setBodyText('Defaults Test');
     $mock = new Zend_Mail_Transport_Mock();
     $mail->send($mock);
     $headers = $mock->headers;
     $this->assertTrue($mock->called);
     $this->assertEquals($mock->from, 'john@example.com');
     $this->assertEquals($headers['From'][0], 'John Doe <john@example.com>');
     $this->assertEquals($headers['Reply-To'][0], 'Foo Bar <foo@example.com>');
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:14,代码来源:MailTest.php

示例11: initMail

 protected function initMail()
 {
     if (isset($this['mail.from.email'])) {
         \Zend_Mail::setDefaultFrom($this['mail.from.email'], $this['mail.from.name']);
     }
     if (isset($this['mail.replyto.email'])) {
         \Zend_Mail::setDefaultReplyTo($this['mail.replyto.email'], $this['mail.replyto.name']);
     }
     // Create transport
     switch (strtolower($this['mail.method'])) {
         case 'smtp':
             $transport = new \Zend_Mail_Transport_Smtp($this['mail.host'], (array) $this['mail.options']);
             \Zend_Mail::setDefaultTransport($transport);
             break;
         case 'sendmail':
         default:
             $transport = new \Zend_Mail_Transport_Sendmail((array) $this['mail.options']);
             \Zend_Mail::setDefaultTransport($transport);
             break;
     }
 }
开发者ID:bombayworks,项目名称:currycms,代码行数:21,代码来源:App.php

示例12: getMail

 /**
  * @static
  * @param  $sender
  * @param  $recipients
  * @param  $subject
  * @return Zend_Mail
  */
 public static function getMail($recipients = null, $subject = null)
 {
     $values = Pimcore_Config::getSystemConfig();
     $valueArray = $values->toArray();
     $emailSettings = $valueArray["email"];
     $mail = new Zend_Mail("UTF-8");
     if (!empty($emailSettings['sender']['email'])) {
         $mail->setDefaultFrom($emailSettings['sender']['email'], $emailSettings['sender']['name']);
     }
     if (!empty($emailSettings['return']['email'])) {
         $mail->setDefaultReplyTo($emailSettings['return']['email'], $emailSettings['return']['name']);
     }
     if ($emailSettings['method'] == "smtp") {
         $config = array();
         if (!empty($emailSettings['smtp']['name'])) {
             $config['name'] = $emailSettings['smtp']['name'];
         }
         if (!empty($emailSettings['smtp']['ssl'])) {
             $config['ssl'] = $emailSettings['smtp']['ssl'];
         }
         if (!empty($emailSettings['smtp']['port'])) {
             $config['port'] = $emailSettings['smtp']['port'];
         }
         if (!empty($emailSettings['smtp']['auth']['method'])) {
             $config['auth'] = $emailSettings['smtp']['auth']['method'];
             $config['username'] = $emailSettings['smtp']['auth']['username'];
             $config['password'] = $emailSettings['smtp']['auth']['password'];
         }
         $transport = new Zend_Mail_Transport_Smtp($emailSettings['smtp']['host'], $config);
         //Logger::log($transport);
         //Logger::log($config);
         $mail->setDefaultTransport($transport);
     }
     if ($recipients) {
         if (is_string($recipients)) {
             $mail->addTo($recipients);
         } else {
             if (is_array($recipients)) {
                 foreach ($recipients as $recipient) {
                     $mail->addTo($recipient);
                 }
             }
         }
     }
     if ($subject) {
         $mail->setSubject($subject);
     }
     return $mail;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:56,代码来源:Tool.php

示例13:

// Create application, bootstrap, and run
$application = new Zend_Application(APPLICATION_ENV, APPLICATION_PATH . '/configs/application.ini');
// the database adapter for the session
Zend_Registry::set("dbAdapter", $application->getBootstrap()->getPluginResource('db')->getDbAdapter());
$cache = $application->getBootstrap()->getPluginResource('cachemanager')->getCacheManager()->getCache('database');
Zend_Registry::set('cache', $cache);
# Zend Translate instance
$translate = new Zend_Translate(array('adapter' => 'ini', 'content' => APPLICATION_PATH . '/configs/en.language.ini'));
# $translate->setCache($cache); // the caching of the translate seems to cause an error, do not know why
Zend_Registry::set('translate', $translate);
# Zend Logger instance
Zend_Registry::set("logger", $application->getBootstrap()->getPluginResource('log')->getLog());
# currency object
$currency = new Zend_Currency('en_US');
$currency->setCache($cache);
Zend_Registry::set('currency', $currency);
# Zend Mail instance
// create a new instance
$mailer = new Zend_Mail('utf8');
// set the default transport configured in application.ini
$mailer->setDefaultTransport($application->getBootstrap()->getPluginResource('mail')->getMail());
// set the default to and from addresses
$mail_config = new Zend_Config($application->getBootstrap()->getPluginResource('mail')->getOptions());
$mailer->setDefaultFrom($mail_config->defaultFrom->email, $mail_config->defaultFrom->name);
$mailer->setDefaultReplyTo($mail_config->defaultReplyTo->email, $mail_config->defaultReplyTo->name);
// add the mail instance to the registry
Zend_Registry::set("mail", $mailer);
// add caching for Zend_Table which is used for Session information
Zend_Db_Table_Abstract::setDefaultMetadataCache($cache);
# run the default page
$application->bootstrap()->run();
开发者ID:7thZoneTechnology,项目名称:hrms-1,代码行数:31,代码来源:index.php


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