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


PHP Zend_Mail类代码示例

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


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

示例1: execute

 protected function execute($arguments = array(), $options = array())
 {
     // initialize the database connection
     $databaseManager = new sfDatabaseManager($this->configuration);
     $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection();
     ProjectConfiguration::setupMailer();
     $queue_table = Doctrine::getTable('MailQueue');
     $queue = $queue_table->getPending($arguments['limit']);
     $done = array();
     $failed = array();
     foreach ($queue as $item) {
         try {
             $mail = new Zend_Mail('utf-8');
             $mail->setSubject($item['subject']);
             $mail->setBodyText($item['body']);
             array_map(array($mail, 'addTo'), explode(',', $item['recipients']));
             $mail->send();
             $done[] = $item['id'];
         } catch (Zend_Exception $e) {
             $failed[] = $item['id'];
         }
     }
     $queue_table->deleteItems($done);
     $queue_table->recordAttemps($failed);
     $this->logSection('mailer', sizeof($done) . ' emails sent');
     $this->logSection('mailer', sizeof($failed) . ' emails failed');
 }
开发者ID:nurihan007,项目名称:amaranto,代码行数:27,代码来源:sendMailsTask.class.php

示例2: sendMail

 public function sendMail(Zend_Mail $mail, $body, $headers)
 {
     /**
      * @todo error checking
      */
     mail(join(',', $mail->getRecipients()), $mail->getSubject(), $body, $headers);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:7,代码来源:Sendmail.php

示例3: getMail

 /**
  * Return a new zend mail instance
  *
  * @return Zend_Mail
  */
 protected function getMail()
 {
     $mail = new Zend_Mail();
     $mail->setSubject('Subject');
     $mail->setBodyText('Body');
     return $mail;
 }
开发者ID:JellyBellyDev,项目名称:zle,代码行数:12,代码来源:TransportTest.php

示例4: createAction

 /**
  * Enter description here...
  *
  */
 public function createAction()
 {
     $this->requirePost();
     $form = $this->getNewResidentForm();
     if ($form->isValid($_POST)) {
         if (!Table_Residents::getInstance()->residentExists($form->getValue('email'))) {
             $data = $form->getValues();
             $password = rand(10000, 9999999);
             $data['password_hash'] = md5($password);
             unset($data['aufnehmen']);
             $newResident = Table_Residents::getInstance()->createRow($data);
             if ($newResident && $newResident->save()) {
                 $websiteUrl = Zend_Registry::get('configuration')->basepath;
                 $mailText = "Du wurdest in die WG aufgenommen.\n\t\t\t\t\tDu kannst dich nun unter {$websiteUrl}/session/new anmelden.\n\n\t\t\t\t\tDeine Zugangsdaten:\n\n\t\t\t\t\tEmail Addresse = {$newResident->email}\n\t\t\t\t\tPassword = {$password}";
                 $mail = new Zend_Mail();
                 $mail->addTo($newResident->email)->setSubject("Du wurdest in der WG aufgenomme!")->setBodyText($mailText);
                 $mail->send();
                 $this->flash('Der Bewohner mit der Email Addresse ' . $newResident->email . ' wurde erfolgreich eingetragen.');
                 $this->flash('Ein generiertes Passwort wurde per Email zugeschickt.');
                 $this->redirect('index');
             } else {
                 $this->flash('Es trat ein Fehler beim speichern des neuen Bewohners auf.');
                 $this->redirect('new');
             }
         } else {
             $this->flash('Ein Bewohner mit der Emailaddresse ' . $form->getValue('email') . ' existiert bereits.');
             $this->redirect('new');
         }
     } else {
         $this->redirect('new');
     }
 }
开发者ID:h-xx,项目名称:wg-organizer,代码行数:36,代码来源:ResidentsController.php

示例5: answerAction

 public function answerAction()
 {
     $request = $this->getRequest();
     $table = new ZfBlank_DbTable_Feedback();
     if ($request->isPost()) {
         $post = $request->getPost();
         $msg = $table->find($post['id'])->getRow(0);
         if ($msg->validateForm($post, new Admin_Form_Feedback())) {
             $msg->setFromForm()->save();
             if ($post['sendAnswer']) {
                 $mail = new Zend_Mail('UTF-8');
                 $mail->addTo($msg->getAuthor(), $msg->getContact());
                 $mail->setFrom($this->_adminAddress, $this->_adminBot);
                 $mail->setSubject('Answer on your message');
                 $mailText = "Message text (TODO)";
                 $mail->setBodyText($mailText);
                 //$mail->send();
             }
             $this->_redirect('/admin/feedback/index/type/unanswered');
         }
         $this->view->form = $msg->form();
     } else {
         $msg = $table->find($request->getParam('id'))->getRow(0);
         $form = new Admin_Form_Feedback();
         $form->setDefaults($msg->getValues());
         $this->view->form = $form;
     }
 }
开发者ID:BackupTheBerlios,项目名称:zfblank,代码行数:28,代码来源:FeedbackController.php

示例6: testSendMail

 public function testSendMail()
 {
     $mail = new Zend_Mail();
     $mail->setBodyText('This mail should never be sent.');
     $mailTransport = new Centurion_Mail_Transport_Blackhole();
     $mailTransport->send($mail);
 }
开发者ID:rom1git,项目名称:Centurion,代码行数:7,代码来源:BlackHoleTest.php

示例7: indexAction

    public function indexAction()
    {
        $formulario = new Application_Form_Contacto();
        $modelo = new Application_Model_Contacto();
        if ($this->getRequest()->isPost()) {
            if ($formulario->isValid($this->_getAllParams())) {
                $modelo->grabarDatos($formulario->getValues());
                $alldata = $this->getAllParams();
                $mail = new Zend_Mail('UTF-8');
                $mail->setBodyHtml('Detalle del Contacto' . '<br>' . 'Nombre:' . $alldata['nombre'] . '<br>' . 'Cargo: ' . $alldata['cargo'] . '<br>' . 'Correo Electrónico: ' . $alldata['correo'] . '<br>' . 'Empresa:' . $alldata['empresa'] . '<br>' . 'Mensaje:' . $alldata['mensaje'] . '<br>');
                $mail->addTo('info@grupoinested.com', 'Grupo Inested Internacional Website');
                $mail->setSubject('Contacto Website Grupo Inested');
                $enviar = $mail->send();
                if ($enviar) {
                    $this->view->mensaje = '<div class="alert alert alert-success" color:black; height: 18px;">
														 <button type="button" class="close" data-dismiss="alert">&times;</button> 
														 Mensaje enviado con Éxito
												   </div>';
                    $formulario->reset();
                } else {
                    $this->view->mensaje = '<div class="alert alert-error" color:black; height: 18px;">
														 <button type="button" class="close" data-dismiss="alert">&times;</button> 
														 Error, no se pudo enviar el mensaje
												   </div>';
                    $formulario->reset();
                }
            }
        }
        $this->view->contacto = $formulario;
        $this->view->powered = '<h6> Desarrollado por <a href="http://www.gimalca.com/">Gimalca Soluciones</a></h6>';
    }
开发者ID:Gimalca,项目名称:grupoinested,代码行数:31,代码来源:IndexController.php

示例8: recoverAction

 public function recoverAction()
 {
     $request = $this->getRequest();
     $registry = Zend_Registry::getInstance();
     $auth = Zend_Auth::getInstance();
     $config = $registry->get('config');
     if ($auth->hasIdentity()) {
         $registry->set("pleaseSignout", true);
         return $this->_forward("index", "logout");
     }
     $people = Ml_Model_People::getInstance();
     $recover = Ml_Model_Recover::getInstance();
     $form = $recover->form();
     if ($request->isPost() && $form->isValid($request->getPost())) {
         $find = $form->getValues();
         //AccountRecover.php validator pass this data: not very hortodox
         $getUser = $registry->accountRecover;
         $securityCode = $recover->newCase($getUser['id']);
         $this->view->securitycode = $securityCode;
         $this->view->recoverUser = $getUser;
         $this->view->recovering = true;
         $mail = new Zend_Mail();
         $mail->setBodyText($this->view->render("password/emailRecover.phtml"))->setFrom($config['robotEmail']['addr'], $config['robotEmail']['name'])->addTo($getUser['email'], $getUser['name'])->setSubject('Recover your ' . $config['applicationname'] . ' account')->send();
     }
     $this->view->recoverForm = $form;
 }
开发者ID:henvic,项目名称:MediaLab,代码行数:26,代码来源:PasswordController.php

示例9: indexAction

    public function indexAction()
    {
        $this->view->headTitle('Contato');
        $categoriaModel = new Application_Model_Categoria();
        $nome_categorias = $categoriaModel->fetchAll($categoriaModel->select()->from($categoriaModel->info(Zend_Db_Table_Abstract::NAME))->columns(array('nome_categoria')));
        $this->view->categorias = $nome_categorias;
        require_once APPLICATION_PATH . '/forms/Contato.php';
        $this->view->form = new Application_Form_Contato();
        if ($this->_request->isPost()) {
            $this->view->form->setDefaults($this->_request->getPost());
            $data = $this->view->form->getValues();
            if ($this->view->form->isValid($data)) {
                $contatosModel = new Application_Model_Contatos();
                $id = $contatosModel->insert($data);
                $data = '<html><body><table>
					<tr><td>Nome</td>
					<td>' . $_POST['nome'] . '</td></tr>
					<tr><td>E-mail</td>
					<td>' . $_POST['email'] . '</td></tr>
					<tr><td>Telefone</td>
					<td>' . $_POST['telefone'] . '</td></tr>
					<tr><td>Texto</td>
					<td>' . $_POST['mensagem'] . '</td></tr>
					</table></body></html>';
                // Using the ini_set()
                ini_set("SMTP", "localhost");
                ini_set("sendmail_from", "willian@mundoorange.com.br");
                ini_set("smtp_port", "587");
                $mail = new Zend_Mail('UTF-8', 'ISO-8859-8');
                $mail->setBodyHtml($data)->setFrom('willian@mundoorange.com.br', 'Formulario de Contato')->addTo('all_sweet_dreams@hotmail.com', 'Contato')->setSubject('Contato')->send();
                return $this->_helper->redirector('index');
            }
        }
    }
开发者ID:BGCX067,项目名称:f1n4l-pr0j3c7-f0r-t3h-0n35-wh0-n33d-17-svn-to-git,代码行数:34,代码来源:ContatoController.php

示例10: __construct

 private function __construct()
 {
     // setup file error logging
     $file_writer = new Logger_Errorlog();
     if (Config::get_optional("DEBUG_LOG") == false) {
         $file_writer->addFilter(Zend_Log::INFO);
     }
     $log = new Zend_Log();
     $log->addWriter($file_writer);
     // setup email error logging
     if (Config::get_optional("log_to_email") == true) {
         $mail = new Zend_Mail();
         $mail->setFrom(Config::get_mandatory('log_email_from'));
         $mail->addTo(Config::get_mandatory('log_email_to'));
         // setup email template
         $layout = new Zend_Layout();
         $layout->setLayoutPath(DOCUMENT_ROOT . Config::get_mandatory("log_email_template"));
         $layout->setLayout('error-logger');
         $layout_formatter = new Zend_Log_Formatter_Simple('<li>.' . Zend_Log_Formatter_Simple::DEFAULT_FORMAT . '</li>');
         // Use default HTML layout.
         $email_writer = new Zend_Log_Writer_Mail($mail, $layout);
         $email_writer->setLayoutFormatter($layout_formatter);
         $email_writer->setSubjectPrependText(Config::get_mandatory('log_email_subject_prepend'));
         $email_writer->addFilter(Zend_Log::ERR);
         $log->addWriter($email_writer);
     }
     self::$logger = $log;
 }
开发者ID:ThibautLeger,项目名称:123-mini,代码行数:28,代码来源:Logger.php

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

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

示例13: sendAction

 public function sendAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     if ($this->getRequest()->isPost()) {
         $name = $this->getRequest()->getPost('Name');
         $email = $this->getRequest()->getPost('Email');
         $subject = $this->getRequest()->getPost('Subject');
         $content = $this->getRequest()->getPost('Content');
         $html = $content;
         $mail = new Zend_Mail();
         $mail->addTo($email, $name)->setSubject($subject)->setBodyHtml($html);
         if ($mail->send()) {
             $status = 'Success';
             $msg = 'Send email success.';
         } else {
             $status = 'Error';
             $msg = 'Send email fault.';
         }
     } else {
         $status = 'Error';
         $msg = 'Not found POST value.';
     }
     echo Zend_Json::encode(array('status' => $status, 'msg' => $msg));
 }
开发者ID:laiello,项目名称:mock-project,代码行数:25,代码来源:MailController.php

示例14: _sendNewCommentEmail

 /**
  * Send email notification to moderators when a new comment is posted
  * 
  * @todo move logic to model / library class
  * 
  * @param HumanHelp_Model_Comment $comment
  * @param HumanHelp_Model_Page $page
  */
 public function _sendNewCommentEmail(HumanHelp_Model_Comment $comment, HumanHelp_Model_Page $page)
 {
     $config = Zend_Registry::get('config');
     $emailTemplate = new Zend_View();
     $emailTemplate->setScriptPath(APPLICATION_PATH . '/views/emails');
     $emailTemplate->addHelperPath(APPLICATION_PATH . '/views/helpers', 'HumanHelp_View_Helper_');
     $emailTemplate->setEncoding('UTF-8');
     $emailTemplate->comment = $comment;
     $emailTemplate->page = $page;
     $emailTemplate->baseUrl = 'http://' . $_SERVER['HTTP_HOST'] . $this->view->baseUrl;
     $bodyHtml = $emailTemplate->render('newComment.phtml');
     $bodyText = $emailTemplate->render('newComment.ptxt');
     $mail = new Zend_Mail();
     $mail->setType(Zend_Mime::MULTIPART_ALTERNATIVE)->setBodyHtml($bodyHtml, 'UTF-8')->setBodyText($bodyText, 'UTF-8')->setSubject("New comment on '{$page->getTitle()}' in '{$page->getBook()->getTitle()}'")->setFrom($config->fromAddress, $config->fromName);
     if (is_object($config->notifyComments)) {
         foreach ($config->notifyComments->toArray() as $rcpt) {
             $mail->addTo($rcpt);
         }
     } else {
         $mail->addTo($config->notifyComments);
     }
     if ($config->smtpServer) {
         $transport = new Zend_Mail_Transport_Smtp($config->smtpServer, $config->smtpOptions->toArray());
     } else {
         $transport = new Zend_Mail_Transport_Sendmail();
     }
     $mail->send($transport);
 }
开发者ID:shevron,项目名称:HumanHelp,代码行数:36,代码来源:IndexController.php

示例15: sendmail

function sendmail($subject, $mailcontent, $receiver, $receivername, $attachment = "")
{
    //die($subject." | ".$mailcontent." | ".$receiver." | ".$receivername);
    try {
        $mail = new Zend_Mail();
        $mail->setBodyHtml($mailcontent)->setFrom('info@pepool.com', 'Pepool')->addTo($receiver, $receivername)->setSubject($subject)->send();
    } catch (Zend_Exception $e) {
    }
    /*
    if(strpos($_SERVER['HTTP_HOST'],"localhost"))return false;
    $mail = new phpmailer();
    $mail->IsSMTP();
    $mail->Subject  =  $subject;
    $mail->Body  = $mailcontent;
    $mail->AddAddress($receiver, $receivername);
    $mail->IsHTML(true);
    if($attachment != '')$mail->AddAttachment($attachment);
    
    if(!$mail->Send())
    {
    	$headers  = 'MIME-Version: 1.0' . "\r\n";
    	$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    	$headers .= "To: $receivername <$receiver>" . "\r\n";
    	$headers .= "From: Pepool <info@pepool.com>" . "\r\n";
    	mail($receiver, $subject, $mailcontent, $headers);
    }
    */
    return true;
}
开发者ID:gauravstomar,项目名称:Pepool,代码行数:29,代码来源:SendMail.php


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