本文整理汇总了PHP中Zend_Mail类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mail类的具体用法?PHP Zend_Mail怎么用?PHP Zend_Mail使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Mail类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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('[email protected]', '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">×</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">×</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", "[email protected]");
ini_set("smtp_port", "587");
$mail = new Zend_Mail('UTF-8', 'ISO-8859-8');
$mail->setBodyHtml($data)->setFrom('[email protected]', 'Formulario de Contato')->addTo('[email protected]', '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('[email protected]', '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('[email protected]', '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 <[email protected]>" . "\r\n";
mail($receiver, $subject, $mailcontent, $headers);
}
*/
return true;
}
开发者ID:gauravstomar,项目名称:Pepool,代码行数:29,代码来源:SendMail.php
示例16: _sendEmail
protected function _sendEmail(array $email, array $user, Zend_Mail_Transport_Abstract $transport)
{
if (!$user['email']) {
return;
}
$phraseTitles = XenForo_Helper_String::findPhraseNamesFromStringSimple($email['email_title'] . $email['email_body']);
/** @var XenForo_Model_Phrase $phraseModel */
$phraseModel = XenForo_Model::create('XenForo_Model_Phrase');
$phrases = $phraseModel->getPhraseTextFromPhraseTitles($phraseTitles, $user['language_id']);
foreach ($phraseTitles as $search => $phraseTitle) {
if (isset($phrases[$phraseTitle])) {
$email['email_title'] = str_replace($search, $phrases[$phraseTitle], $email['email_title']);
$email['email_body'] = str_replace($search, $phrases[$phraseTitle], $email['email_body']);
}
}
$mailObj = new Zend_Mail('utf-8');
$mailObj->setSubject($email['email_title'])->addTo($user['email'], $user['username'])->setFrom($email['from_email'], $email['from_name']);
$options = XenForo_Application::getOptions();
$bounceEmailAddress = $options->bounceEmailAddress;
if (!$bounceEmailAddress) {
$bounceEmailAddress = $options->defaultEmailAddress;
}
$toEmail = $user['email'];
$bounceHmac = substr(hash_hmac('md5', $toEmail, XenForo_Application::getConfig()->globalSalt), 0, 8);
$mailObj->addHeader('X-To-Validate', "{$bounceHmac}+{$toEmail}");
if ($options->enableVerp) {
$verpValue = str_replace('@', '=', $toEmail);
$bounceEmailAddress = str_replace('@', "+{$bounceHmac}+{$verpValue}@", $bounceEmailAddress);
}
$mailObj->setReturnPath($bounceEmailAddress);
if ($email['email_format'] == 'html') {
$replacements = array('{name}' => htmlspecialchars($user['username']), '{email}' => htmlspecialchars($user['email']), '{id}' => $user['user_id']);
$email['email_body'] = strtr($email['email_body'], $replacements);
$text = trim(htmlspecialchars_decode(strip_tags($email['email_body'])));
$mailObj->setBodyHtml($email['email_body'])->setBodyText($text);
} else {
$replacements = array('{name}' => $user['username'], '{email}' => $user['email'], '{id}' => $user['user_id']);
$email['email_body'] = strtr($email['email_body'], $replacements);
$mailObj->setBodyText($email['email_body']);
}
if (!$mailObj->getMessageId()) {
$mailObj->setMessageId();
}
$thisTransport = XenForo_Mail::getFinalTransportForMail($mailObj, $transport);
try {
$mailObj->send($thisTransport);
} catch (Exception $e) {
if (method_exists($thisTransport, 'resetConnection')) {
XenForo_Error::logException($e, false, "Email to {$user['email']} failed: ");
$thisTransport->resetConnection();
try {
$mailObj->send($thisTransport);
} catch (Exception $e) {
XenForo_Error::logException($e, false, "Email to {$user['email']} failed (after retry): ");
}
} else {
XenForo_Error::logException($e, false, "Email to {$user['email']} failed: ");
}
}
}
开发者ID:darkearl,项目名称:projectT122015,代码行数:60,代码来源:UserEmail.php
示例17: GetEmailAddresses
private function GetEmailAddresses($s_sql, Zend_Mail $email)
{
$a_send = null;
if ($s_sql) {
$result = $this->GetDataConnection()->query($s_sql);
while ($o_row = $result->fetch()) {
# first up, if this is a review item, get the title
if (isset($o_row->title)) {
$this->s_review_item_title = $o_row->title;
}
# check if person in the previous subscriptions
if (!is_array($this->a_emails) or !in_array($o_row->email, $this->a_emails)) {
#...add to email list
$a_send[] = $o_row->email;
# ... add also to list of people sent, to exclude from further emails
$this->a_emails[] = $o_row->email;
}
}
$result->closeCursor();
if (is_array($a_send)) {
foreach ($a_send as $address) {
$email->addBcc($address);
}
}
}
return is_array($a_send);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:27,代码来源:subscription-manager.class.php
示例18: recoveryPasswordCliente
public function recoveryPasswordCliente($email)
{
try {
if ($this->_modelUser->verificarEmail($email) == true) {
try {
$where = $this->_modelUser->getAdapter()->quoteInto('email = ?', $email);
$user = $this->_modelUser->fetchAll($where);
$html = new Zend_View();
$html->setScriptPath(APPLICATION_PATH . '/assets/templates/');
// enviando variaveis para a view
$html->assign('nome', $user[0]['nome']);
$html->assign('email', $user[0]['email']);
$html->assign('senha', $user[0]['passw']);
// criando objeto email
$mail = new Zend_Mail('utf-8');
// render view
$bodyText = $html->render('esqueciasenha.phtml');
// configurar envio
$mail->addTo($user[0]['email']);
$mail->setSubject('Esqueci a senha ');
$mail->setFrom('[email protected]', 'Resort Villa Hípica');
$mail->setBodyHtml($bodyText);
$mail->send();
return true;
} catch (Exception $e) {
throw $e;
}
} else {
return false;
}
} catch (Exception $e) {
throw $e;
}
}
开发者ID:pccnf,项目名称:sitevilla,代码行数:34,代码来源:AuthService.php
示例19: send
public function send()
{
if (!Mage::getStoreConfig('amsmtp/general/enable')) {
return parent::send();
}
if (Mage::getStoreConfigFlag('system/smtp/disable')) {
return $this;
}
Mage::helper('amsmtp')->debug('Ready to send e-mail at amsmtp/core_email::send()');
$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());
$logId = Mage::helper('amsmtp')->log(array('subject' => $this->getSubject(), 'body' => $this->getBody(), 'recipient_name' => $this->getToName(), 'recipient_email' => $this->getToEmail(), 'template_code' => 'none', 'status' => Amasty_Smtp_Model_Log::STATUS_PENDING));
try {
$transportFacade = Mage::getModel('amsmtp/transport');
if (!Mage::getStoreConfig('amsmtp/general/disable_delivery')) {
$mail->send($transportFacade->getTransport());
} else {
Mage::helper('amsmtp')->debug('Actual delivery disabled under settings.');
}
Mage::helper('amsmtp')->logStatusUpdate($logId, Amasty_Smtp_Model_Log::STATUS_SENT);
Mage::helper('amsmtp')->debug('E-mail sent successfully at amsmtp/core_email::send().');
} catch (Exception $e) {
Mage::helper('amsmtp')->logStatusUpdate($logId, Amasty_Smtp_Model_Log::STATUS_FAILED);
Mage::helper('amsmtp')->debug('Error sending e-mail: ' . $e->getMessage());
}
return $this;
}
开发者ID:CE-Webmaster,项目名称:CE-Hub,代码行数:32,代码来源:Email.php
示例20: 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'));
$charset = "utf-8";
#$charset = "iso-8859-1";
$mail = new Zend_Mail($charset);
$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) {
if ($charset === "utf-8") {
$mail->addTo($email, '=?utf-8?B?' . base64_encode($email) . '?=');
} else {
$mail->addTo($email, $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));
if ($charset === "utf-8") {
$mail->setSubject('=?utf-8?B?' . base64_encode($this->_replaceVariables($this->getDestination()->getEmailSubject(), implode("\n\n", $fileArray))) . '?=');
} else {
$mail->setSubject($this->_replaceVariables($this->getDestination()->getEmailSubject(), implode("\n\n", $fileArray)));
}
$mail->setBodyText(strip_tags($this->_replaceVariables($this->getDestination()->getEmailBody(), implode("\n\n", $fileArray))));
$mail->setBodyHtml($this->_replaceVariables($this->getDestination()->getEmailBody(), implode("\n\n", $fileArray)));
try {
$mail->send(Mage::helper('xtcore/utils')->getEmailTransport());
} catch (Exception $e) {
$this->getTestResult()->setSuccess(false)->setMessage(Mage::helper('xtento_orderexport')->__('Error while sending email: %s', $e->getMessage()));
return false;
}
return $savedFiles;
}
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:60,代码来源:Email.php
注:本文中的Zend_Mail类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论