protected function _initMail() { Zend_Mail::setDefaultFrom('*****@*****.**', 'XLR8U Fitness'); Zend_Mail::setDefaultReplyTo('*****@*****.**', 'XLR8U Fitness'); $transport = new Zend_Mail_Transport_Sendmail(); Zend_Mail::setDefaultTransport($transport); }
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); }
/** * 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); }
/** * 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(); }
public function testMethodSendUsesDefaults() { Zend_Mail::setDefaultFrom('*****@*****.**', 'John Doe'); Zend_Mail::setDefaultReplyTo('*****@*****.**', '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, '*****@*****.**'); $this->assertEquals($headers['From'][0], 'John Doe <*****@*****.**>'); $this->assertEquals($headers['Reply-To'][0], 'Foo Bar <*****@*****.**>'); }
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; } }
/** * @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; }
// 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();