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


PHP Zend_Mail::send方法代码示例

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


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

示例1: _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

示例2: sendemailAction

 public function sendemailAction()
 {
     $mailaddress = $this->getRequest()->getPost("mailaddress");
     $firstname = $this->getRequest()->getPost("firstname");
     $surname = $this->getRequest()->getPost("surname");
     $subject = $this->getRequest()->getPost("subject");
     $message = $this->getRequest()->getPost("message");
     if ($mailaddress == "" || $firstname == "" || $surname == "" || $subject == "" || $message == "") {
         $this->_redirect('/liens/fail');
     }
     $key = $this->getRequest()->getPost("sendto");
     if (array_key_exists($key, $this->_sendto)) {
         $mail = new Zend_Mail('UTF-8');
         $mail->setBodyText($message)->setFrom($mailaddress, $firstname . ' ' . $surname)->addTo($this->_sendto[$key], $this->_names[$key])->setSubject($subject);
         $sent = $mail->send();
         if ($mail->send()) {
             $this->_redirect('/liens/successful');
         } else {
             $this->_redirect('/index');
             $this->_redirect('/liens/fail');
         }
     } else {
         $this->_redirect('/liens/fail/' . $key . array_key_exists($key, $this->_sendto));
     }
 }
开发者ID:H38uS,项目名称:Impulsion,代码行数:25,代码来源:LiensController.php

示例3: send

 /**
  * Send the email
  *
  * @param array $args
  * @return void
  */
 public function send(array $args)
 {
     if (!Zend_Registry::get('IS_PRODUCTION') && !App_DI_Container::get('ConfigObject')->testing->mail) {
         $this->_log(Zend_Layout::getMvcInstance()->getView()->partial($this->_template, $args));
     } else {
         if (App_DI_Container::get('ConfigObject')->system->gearman_support) {
             App_DI_Container::get('GearmanClient')->doBackground('send_email', serialize(array('to' => $this->recipients, 'subject' => $this->_subject, 'html' => Zend_Layout::getMvcInstance()->getView()->partial($this->_template, $args), 'reply' => array_key_exists('replyTo', $args) ? $args['replyTo']->email : NULL, 'attachment' => array_key_exists('attachment', $args) ? $args['attachment'] : NULL, 'type' => $args['type'])));
         } else {
             $mail = new Zend_Mail('utf-8');
             if (App_DI_Container::get('ConfigObject')->system->email_system->send_by_amazon_ses) {
                 $transport = new App_Mail_Transport_AmazonSES(array('accessKey' => App_DI_Container::get('ConfigObject')->amazon->aws_access_key, 'privateKey' => App_DI_Container::get('ConfigObject')->amazon->aws_private_key));
             }
             $mail->setBodyHtml(Zend_Layout::getMvcInstance()->getView()->partial($this->_template, $args));
             if (array_key_exists('replyTo', $args)) {
                 $mail->setReplyTo($args['replyTo']->email);
             }
             $mail->setFrom(App_DI_Container::get('ConfigObject')->amazon->ses->from_address, App_DI_Container::get('ConfigObject')->amazon->ses->from_name);
             $mail->addTo($this->recipients);
             $mail->setSubject($this->_subject);
             if (isset($transport) && $transport instanceof App_Mail_Transport_AmazonSES) {
                 $mail->send($transport);
             } else {
                 $mail->send();
             }
         }
     }
 }
开发者ID:omusico,项目名称:logica,代码行数:33,代码来源:Abstract.php

示例4: testemailJsonAction

 function testemailJsonAction()
 {
     //TODO: all this code below is a temp code - we need to delete is later
     //and create new one in EmailNotification module
     $email = $this->_getParam('email');
     if ($email === null) {
         return array('data' => array('success' => false));
     }
     $configModel = new RM_Config();
     $mail = new Zend_Mail('UTF-8');
     $mail->addTo($email);
     $mail->setFrom($configModel->getValue('rm_config_email_settings_mailfrom'), $configModel->getValue('rm_config_email_settings_fromname'));
     $mail->setBodyText($this->_translate->_('Admin.Config.Edit', 'TestEmailMessage'));
     $mail->setSubject($this->_translate->_('Admin.Config.Edit', 'TestEmailSubject'));
     $emailType = $configModel->getValue('rm_config_email_settings_mailer');
     try {
         if ($emailType == 'PHP') {
             $mail->send();
         } else {
             $smtpConfig = array('auth' => 'Login', 'username' => $configModel->getValue('rm_config_email_settings_smtpuser'), 'password' => $configModel->getValue('rm_config_email_settings_smtppass'), 'port' => $configModel->getValue('rm_config_email_settings_smtpport'));
             if ($configModel->getValue('rm_config_email_settings_smtpsecure') != "") {
                 $smtpConfig['ssl'] = strtolower($configModel->getValue('rm_config_email_settings_smtpsecure'));
             }
             $mail->send(new Zend_Mail_Transport_Smtp($configModel->getValue('rm_config_email_settings_smtphost'), $smtpConfig));
         }
     } catch (Zend_Mail_Exception $e) {
         return array('data' => array('success' => false, 'error' => $e->getMessage()));
     }
     return array('data' => array('success' => true));
 }
开发者ID:laiello,项目名称:resmania,代码行数:30,代码来源:ConfigController.php

示例5: send

 public function send()
 {
     $_helper = Mage::helper('smtppro');
     // If it's not enabled, just return the parent result.
     if (!$_helper->isEnabled()) {
         return parent::send();
     }
     if (Mage::getStoreConfigFlag('system/smtp/disable')) {
         return $this;
     }
     $mail = new Zend_Mail();
     if (strtolower($this->getType()) == 'html') {
         $mail->setBodyHtml($this->getBody());
     } else {
         $mail->setBodyText($this->getBody());
     }
     $mail->setFrom($this->getFromEmail(), $this->getFromName())->addTo($this->getToEmail(), $this->getToName())->setSubject($this->getSubject());
     $transport = new Varien_Object();
     // for observers to set if required
     Mage::dispatchEvent('aschroder_smtppro_before_send', array('mail' => $mail, 'email' => $this, 'transport' => $transport));
     if ($transport->getTransport()) {
         // if set by an observer, use it
         $mail->send($transport->getTransport());
     } else {
         $mail->send();
     }
     Mage::dispatchEvent('aschroder_smtppro_after_send', array('to' => $this->getToName(), 'subject' => $this->getSubject(), 'template' => "n/a", 'html' => strtolower($this->getType()) == 'html', 'email_body' => $this->getBody()));
     return $this;
 }
开发者ID:budiperkasa,项目名称:Magento-SMTP-Pro-Email-Extension,代码行数:29,代码来源:Email.php

示例6: send

 /**
  * Odesle E-mail
  *
  * @param string $recipient E-mail prijemce
  */
 public function send($recipient)
 {
     $smtpOptions = array('auth' => 'login', 'username' => 'mybase.unodor@gmail.com', 'password' => 'opticau51', 'ssl' => 'ssl', 'port' => 465);
     $mailTransport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $smtpOptions);
     $this->_mail->setBodyHtml($this->_bodyText);
     $this->_mail->addTo($recipient);
     $this->_mail->send($mailTransport);
 }
开发者ID:besters,项目名称:My-Base,代码行数:13,代码来源:Mail.php

示例7: 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

示例8: saveFiles

 public function saveFiles($fileArray)
 {
     if (empty($fileArray)) {
         return array();
     }
     // Init connection
     $this->initConnection();
     $savedFiles = array();
     @ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
     @ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
     $mail = new Zend_Mail('utf-8');
     $setReturnPath = Mage::getStoreConfig('system/smtp/set_return_path');
     switch ($setReturnPath) {
         case 1:
             $returnPathEmail = $this->getDestination()->getEmailSender();
             break;
         case 2:
             $returnPathEmail = Mage::getStoreConfig('system/smtp/return_path_email');
             break;
         default:
             $returnPathEmail = null;
             break;
     }
     if ($returnPathEmail !== null) {
         $mailTransport = new Zend_Mail_Transport_Sendmail("-f" . $returnPathEmail);
         Zend_Mail::setDefaultTransport($mailTransport);
     }
     $mail->setFrom($this->getDestination()->getEmailSender(), $this->getDestination()->getEmailSender());
     foreach (explode(",", $this->getDestination()->getEmailRecipient()) as $email) {
         $mail->addTo($email, '=?utf-8?B?' . base64_encode($email) . '?=');
     }
     foreach ($fileArray as $filename => $data) {
         if ($this->getDestination()->getEmailAttachFiles()) {
             $attachment = $mail->createAttachment($data);
             $attachment->filename = $filename;
         }
         $savedFiles[] = $filename;
     }
     #$mail->setSubject($this->_replaceVariables($this->getDestination()->getEmailSubject(), $firstFileContent));
     $mail->setSubject('=?utf-8?B?' . base64_encode($this->_replaceVariables($this->getDestination()->getEmailSubject(), implode("\n\n", $fileArray))) . '?=');
     $mail->setBodyText($this->_replaceVariables($this->getDestination()->getEmailBody(), implode("\n\n", $fileArray)));
     try {
         if (Mage::helper('xtcore/utils')->isExtensionInstalled('Aschroder_SMTPPro') && Mage::helper('smtppro')->isEnabled()) {
             // SMTPPro extension
             $mail->send(Mage::helper('smtppro')->getTransport());
         } else {
             $mail->send();
         }
     } catch (Exception $e) {
         $this->getTestResult()->setSuccess(false)->setMessage(Mage::helper('xtento_orderexport')->__('Error while sending email: %s', $e->getMessage()));
         return false;
     }
     return $savedFiles;
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:54,代码来源:Email.php

示例9: postInsert

	/**
	 * Generate token and update user record.
	 * @see Doctrine_Record_Listener::postInsert()
	 */
	public function postInsert(Doctrine_Event $event) {
		$this->_user = $event->getInvoker();

		$this->assignViewVariables();

		$this->_mail->setBodyHtml($this->renderView('html'));
		$this->_mail->setBodyText($this->renderView('plain'));
		$this->_mail->setSubject($this->_subject);
		$this->_mail->addTo($this->_user->email, $this->_nickname);

		$this->_mail->send();
	}
开发者ID:niieani,项目名称:nandu,代码行数:16,代码来源:Email.php

示例10: 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

示例11: send

 public function send($transport = null)
 {
     //return parent::send($transport);
     //        if ($transport === null) {
     //
     //            $config = array('auth' => 'login',
     //            'username' => 'donotreply@xxx.com',
     //            'password' => '1!',
     //                'ssl'=>'ssl',
     //                'port'=>'465'
     //
     //                );
     //            $transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
     //        }
     //$this->clearRecipients();
     //         $config = array('auth' => 'login',
     //            'username' => 'ritesh@xxx.com',
     //            'password' => 'xxx!',
     //                'ssl'=>'ssl',
     //                'port'=>'465'
     //
     //                );
     //        $transport = new Zend_Mail_Transport_Smtp('smtp.profitbyoutsourcing.com',$config);
     //        $this->addBcc(array('Ritesh development mode'=>"ritesh@profitbyoutsourcing.com"));
     return parent::send($transport);
 }
开发者ID:riteshsahu1981,项目名称:Weadvance,代码行数:26,代码来源:Mail.php

示例12: 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

示例13: sendMail

 /**
  * Send a mail based on the configuration in the emails table
  *
  * @throws EngineBlock_Exception in case there is no EmailConfiguration in emails table
  * @param $emailAddress the email address of the recipient
  * @param $emailType the pointer to the emails configuration
  * @param $replacements array where the key is a variable (e.g. {user}) and the value the string where the variable should be replaced
  * @return void
  */
 public function sendMail($emailAddress, $emailType, $replacements)
 {
     $dbh = $this->_getDatabaseConnection();
     $query = "SELECT email_text, email_from, email_subject, is_html FROM emails where email_type = ?";
     $parameters = array($emailType);
     $statement = $dbh->prepare($query);
     $statement->execute($parameters);
     $rows = $statement->fetchAll();
     if (count($rows) !== 1) {
         EngineBlock_ApplicationSingleton::getLog()->err("Unable to send mail because of missing email configuration: " . $emailType);
         return;
     }
     $emailText = $rows[0]['email_text'];
     foreach ($replacements as $key => $value) {
         // Single value replacement
         if (!is_array($value)) {
             $emailText = str_ireplace($key, $value, $emailText);
         } else {
             $replacement = '<ul>';
             foreach ($value as $valElem) {
                 $replacement .= '<li>' . $valElem . '</li>';
             }
             $replacement .= '</ul>';
             $emailText = str_ireplace($key, $replacement, $emailText);
         }
     }
     $emailFrom = $rows[0]['email_from'];
     $emailSubject = $rows[0]['email_subject'];
     $mail = new Zend_Mail('UTF-8');
     $mail->setBodyHtml($emailText, 'utf-8', 'utf-8');
     $mail->setFrom($emailFrom, "SURFconext Support");
     $mail->addTo($emailAddress);
     $mail->setSubject($emailSubject);
     $mail->send();
 }
开发者ID:newlongwhitecloudy,项目名称:OpenConext-engineblock,代码行数:44,代码来源:Mailer.php

示例14: contatoAction

 public function contatoAction()
 {
     if ($this->_request->isPost()) {
         $html = new Zend_View();
         $html->setScriptPath(APPLICATION_PATH . '/modules/default/layouts/scripts/');
         $title = 'Contato | Instag';
         $to = 'eduardo@inndeia.com';
         $cc = 'renato@inndeia.com';
         $html->assign('title', $title);
         $html->assign('nome', $this->_request->getPost('nome'));
         $html->assign('email', $this->_request->getPost('email'));
         $html->assign('assunto', $this->_request->getPost('assunto'));
         $html->assign('mensagem', $this->_request->getPost('mensagem'));
         $mail = new Zend_Mail('utf-8');
         $bodyText = $html->render('contato.phtml');
         $config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => 'nao-responder@instag.com.br', 'password' => 'Inndeia123');
         $transport = new Zend_Mail_Transport_Smtp('127.0.0.1', $config);
         $mail->addTo($to);
         $mail->addCc($cc);
         $mail->setSubject($title);
         $mail->setFrom($this->_request->getPost('email'), $this->_request->getPost('name'));
         $mail->setBodyHtml($bodyText);
         $send = $mail->send($transport);
         if ($send) {
             $this->_helper->flashMessenger->addMessage('Sua mensagem foi enviada com sucesso, em breve entraremos em contato.');
         } else {
             $this->_helper->flashMessenger->addMessage('Falha no envio, tente novamente!');
         }
         $this->_redirect('/index');
     }
 }
开发者ID:pccnf,项目名称:proj_instag,代码行数:31,代码来源:IndexController.php

示例15: shutdown

 /**
  * Sends mail to recipient(s) if log entries are present.  Note that both
  * plaintext and HTML portions of email are handled here.
  *
  * @return void
  */
 public function shutdown()
 {
     // If there are events to mail, use them as message body.  Otherwise,
     // there is no mail to be sent.
     if (empty($this->_eventsToMail)) {
         return;
     }
     if ($this->_subjectPrependText !== null) {
         // Tack on the summary of entries per-priority to the subject
         // line and set it on the Zend_Mail object.
         $numEntries = $this->_getFormattedNumEntriesPerPriority();
         $this->_mail->setSubject("{$this->_subjectPrependText} ({$numEntries})");
     }
     // Always provide events to mail as plaintext.
     $this->_mail->setBodyText(implode('', $this->_eventsToMail));
     // If a Zend_Layout instance is being used, set its "events"
     // value to the lines formatted for use with the layout.
     if ($this->_layout) {
         // Set the required "messages" value for the layout.  Here we
         // are assuming that the layout is for use with HTML.
         $this->_layout->events = implode('', $this->_layoutEventsToMail);
         $this->_mail->setBodyHtml($this->_layout->render());
     }
     // Finally, send the mail, but re-throw any exceptions at the
     // proper level of abstraction.
     try {
         $this->_mail->send();
     } catch (Exception $e) {
         throw new Zend_Log_Exception($e->getMessage(), $e->getCode());
     }
 }
开发者ID:VUW-SIM-FIS,项目名称:emiemi,代码行数:37,代码来源:Mail.php


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