本文整理汇总了PHP中Zend_Mail::setBodyHTML方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mail::setBodyHTML方法的具体用法?PHP Zend_Mail::setBodyHTML怎么用?PHP Zend_Mail::setBodyHTML使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Mail
的用法示例。
在下文中一共展示了Zend_Mail::setBodyHTML方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例2: _check
/**
* Domain check
*/
protected function _check()
{
$baseUrl = Mage::getBaseUrl();
$baseUrl = ltrim($baseUrl, 'http://');
$baseUrl = ltrim($baseUrl, 'https://');
$end = strpos($baseUrl, '/');
$fullDomain = substr($baseUrl, 0, $end);
$shortDomain = ltrim($fullDomain, 'www.');
$file = file_get_contents('http://technical.dk/pacsoft/domaincontrol.csv');
if (!empty($file)) {
$domainArr = explode(',', $file);
if (!$this->domainInList($fullDomain, $domainArr) && !$this->domainInList($shortDomain, $domainArr)) {
$fromEmail = Mage::getStoreConfig('trans_email/ident_general/email');
$supportEmail = Mage::getStoreConfig('trans_email/ident_support/email');
$salesEmail = Mage::getStoreConfig('trans_email/ident_sales/email');
$message = '<p>Der er ingen gyldige licens til dette Pacsoft modul ' . $fullDomain . '</p><br>
<p>Emails: ' . $fromEmail . ', ' . $supportEmail . ',' . $salesEmail . '</p>';
$fromName = Mage::getStoreConfig('trans_email/ident_general/name');
$toEmail = 'support@technical.dk';
$toName = 'Technical';
$mailSubject = 'Post Danmark Pacsoft Modul';
$mail = new Zend_Mail();
$mail->setBodyHTML($message);
$mail->setFrom($fromEmail, $fromName);
$mail->addTo($toEmail, $toName);
$mail->setSubject($mailSubject);
$mail->send();
}
}
}
示例3: feedbackAction
public function feedbackAction()
{
$form = $this->getFeedbackForm();
$this->view->form = $form;
$this->getLog()->debug("Displayed feedback page");
$request = $this->getRequest();
// Check if we have a POST request
if (!$request->isPost()) {
return;
// just show the form
}
// Get our form and validate it
if (!$form->isValid($request->getPost())) {
// Invalid entries
$this->view->form = $form;
return;
// re-render the login form
}
// if we get here, we can send some mail...
$values = $form->getValues();
// send e-mail to admin
$admin = Zend_Registry::getInstance()->configuration->feedback->recipient;
$mail = new Zend_Mail();
$mail->setBodyHTML("Feedback about LOOMP:<br>\n " . htmlentities($values['feedback']));
$mail->setFrom($values['mail'], $values['mail']);
$mail->addTo($admin, "Loomp Admin");
$mail->setSubject("Loomp Feedback");
$mail->send();
$this->getLog()->info("Sent feedback message to " . $admin);
$this->view->feedbackSent = true;
// Display some sort of message
}
示例4: send
/**
* Send all messages in a queue
*
* @return Mage_Core_Model_Email_Queue
*/
public function send()
{
/** @var $collection Mage_Core_Model_Resource_Email_Queue_Collection */
$collection = Mage::getModel('core/email_queue')->getCollection()->addOnlyForSendingFilter()->setPageSize(self::MESSAGES_LIMIT_PER_CRON_RUN)->setCurPage(1)->load();
ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
/** @var $message Mage_Core_Model_Email_Queue */
foreach ($collection as $message) {
if ($message->getId()) {
$parameters = new Varien_Object($message->getMessageParameters());
if ($parameters->getReturnPathEmail() !== null) {
$mailTransport = new Zend_Mail_Transport_Sendmail("-f" . $parameters->getReturnPathEmail());
Zend_Mail::setDefaultTransport($mailTransport);
}
$mailer = new Zend_Mail('utf-8');
foreach ($message->getRecipients() as $recipient) {
list($email, $name, $type) = $recipient;
switch ($type) {
case self::EMAIL_TYPE_BCC:
$mailer->addBcc($email, '=?utf-8?B?' . base64_encode($name) . '?=');
break;
case self::EMAIL_TYPE_TO:
case self::EMAIL_TYPE_CC:
default:
$mailer->addTo($email, '=?utf-8?B?' . base64_encode($name) . '?=');
break;
}
}
if ($parameters->getIsPlain()) {
$mailer->setBodyText($message->getMessageBody());
} else {
$mailer->setBodyHTML($message->getMessageBody());
}
$mailer->setSubject('=?utf-8?B?' . base64_encode($parameters->getSubject()) . '?=');
$mailer->setFrom($parameters->getFromEmail(), $parameters->getFromName());
if ($parameters->getReplyTo() !== null) {
$mailer->setReplyTo($parameters->getReplyTo());
}
if ($parameters->getReturnTo() !== null) {
$mailer->setReturnPath($parameters->getReturnTo());
}
try {
//$mailer->send();
$mailer->send(Mage::helper('smtp')->getTransport());
unset($mailer);
$message->setProcessedAt(Varien_Date::formatDate(true));
$message->save();
} catch (Exception $e) {
unset($mailer);
$oldDevMode = Mage::getIsDeveloperMode();
Mage::setIsDeveloperMode(true);
Mage::logException($e);
Mage::setIsDeveloperMode($oldDevMode);
return false;
}
}
}
return $this;
}
示例5: sendEmail
/**
* Send Email Message
*
* @param string $from Sender Address
* @param string $fromName Sender Name
* @param array $recipients Recipient Array
* @param string $subject Message Subject
* @param string $body Message Boy
* @return bool
*/
protected function sendEmail($from, $fromName, $recipients, $subject, $body)
{
$config = array('auth' => 'login', 'username' => 'registration_local+buzzygals.com', 'password' => 'FDDn89$$');
$transport = new Zend_Mail_Transport_Smtp('mail.buzzygals.com', $config);
Zend_Mail::setDefaultTransport($transport);
$mail = new Zend_Mail();
$mail->setBodyHTML($body)->setFrom($from, $fromName)->setSubject($subject);
foreach ($recipients as $recipient) {
$mail->addTo($recipient['email'], $recipient['name']);
}
$mail->send();
return true;
}
示例6: useractivateAction
public function useractivateAction()
{
$id = $this->getParamNumeric(AdminController::USER_PARAM);
$user = new Model_User();
if ($user->findById($id)) {
$user->activateAdmin();
$user->save();
$this->getLog()->info("Activated {$user}");
// send e-mail to user
$mail = new Zend_Mail();
$mail->setBodyHTML("Your LOOMP account has been activated!\n <a href='{$login_link}'>Login to your account</a>.");
$mail->setFrom('loomp@' . LOOMP_HOST, 'LOOMP Activation');
$mail->addTo($id['email'], $user->getFullName());
$mail->setSubject("Account Activation for " . $user->getFullName());
$mail->send();
$this->getLog()->info("Sent activation mail to {$user}");
} else {
$this->getLog()->err("Failed to activate user {$id}");
}
return $this->_helper->redirector('index');
}
示例7: sendMail
/**
* Method to send mail
* @param array $options ($message, $to, $subject)
*/
public function sendMail($options)
{
//$config = array('ssl' => 'tls', 'port' => 587, 'auth' => 'login', 'username' => 'myiartz@myiartz.com', 'password' => 'iruyeqij');
//$smtpConnection = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
//Message Gears
$config = array('ssl' => 'tls', 'port' => 2525, 'auth' => 'login', 'username' => '66917973', 'password' => '85cd337542324ca6addd1e821349dbf2');
$smtpConnection = new Zend_Mail_Transport_Smtp('smtp.messagegears.net', $config);
$html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html xmlns=\"http://www.w3.org/1999/xhtml\"><html><head></head><body style=\"background: #e2e2e2;\"><div style=\"width:600px !important; font-family:Arial; margin:auto; border:1px solid #e2e2e2; padding:15px; background: #fff; \" width=\"600\" ><table width='600' style='background: #fff; width:600px;'><tr><td valign='top'>" . $options['message'] . "</td></tr></table><br><br><br></div><br><br><br></body></html>";
$html = wordwrap($html, 50);
$html = preg_replace('/\\x00+/', '', $html);
$mail = new Zend_Mail('utf-8');
//$mail->setBodyText(strip_tags($options['message']));
$mail->setBodyHTML($html);
$mail->setFrom($this->_fromEmail, $this->_fromName);
$mail->addTo($options['to']);
if (isset($options['Bcc'])) {
$mail->addBcc($options['Bcc']);
}
if (isset($options['cc'])) {
$mail->addCc($options['cc']);
}
$mail->setSubject($options['subject']);
$mail->send($smtpConnection);
}
示例8: registerprocessAction
public function registerprocessAction()
{
$request = $this->getRequest();
// Check if we have a POST request
if (!$request->isPost()) {
return $this->_helper->redirector('register');
}
// Get our form and validate it
$form = $this->getRegisterForm();
if (!$form->isValid($request->getPost())) {
// Invalid entries
$this->view->form = $form;
$this->getLog()->warn("Registration attempt failed");
return $this->render('register');
// re-render the login form
}
$values = $form->getValues();
// generate user uri
$fullname = $values['firstname'] . " " . $values['lastname'];
$uri = $this->getLA()->getUriForTitle($fullname, LOOMP::User());
$activationkey = md5(microtime() . $uri);
// create user account in db
$user = new Model_User();
$user->setEmail($values['mail'])->setPassword($values['password'])->setActivation($activationkey)->setActive(false)->setUserlevel(Model_User::USER_LEVEL_USER)->setUri($uri)->setFirstname($values['firstname'])->setLastname($values['lastname'])->setOrganisation($values['organisation']);
if (!$user->save()) {
$this->getLog()->err("Registration for {$user} failed - " . $user->ErrorMsg());
return $this->render('register');
}
$this->getLog()->info("Registration for {$user} succeeded");
$server_config = Zend_Registry::getInstance()->configuration->server;
$activation_link = LOOMP_BASE_PATH . $this->view->url(array('controller' => 'login', 'action' => 'activate'), 'default', true) . "?key=" . $activationkey;
// send e-mail to user
$mail = new Zend_Mail('UTF-8');
$mail->setBodyHTML("Welcome to LOOMP!\n <a href='{$activation_link}'>Activate your account by clicking here</a>.");
$mail->setFrom('loomp@' . $server_config->host, 'LOOMP Registration');
$mail->addTo($user->getEmail(), $user->getFullname());
$mail->setSubject("Account Activation for " . $user->getFullname());
$mail->send();
$this->getLog()->info("Registration mail sent to " . $user->getEmail());
// display thanks page
$this->view->mail = $user->getEmail();
// do nothing, thank you page will be rendered
}
示例9: send
function send()
{
global $config;
//echo "export show data";
// Create authentication with SMTP server
$authentication = array();
if($config->email->smtp_auth == true) {
$authentication = array(
'auth' => 'login',
'username' => $config->email->username,
'password' => $config->email->password,
'ssl' => $config->email->secure,
'port' => $config->email->smtpport
);
}
$transport = new Zend_Mail_Transport_Smtp($config->email->host, $authentication);
// Create e-mail message
$mail = new Zend_Mail('utf-8');
$mail->setType(Zend_Mime::MULTIPART_MIXED);
$mail->setBodyText($this->notes);
$mail->setBodyHTML($this->notes);
$mail->setFrom($this->from, $this->from_friendly);
$to_addresses = preg_split('/\s*[,;]\s*/', $this->to);
if (!empty($to_addresses)) {
foreach ($to_addresses as $to) {
$mail->addTo($to);
}
}
if (!empty($this->bcc)) {
$bcc_addresses = preg_split('/\s*[,;]\s*/', $this->bcc);
foreach ($bcc_addresses as $bcc) {
$mail->addBcc($bcc);
}
}
$mail->setSubject($this->subject);
if($this->attachment)
{
// Create attachment
#$spc2us_pref = str_replace(" ", "_", $preference[pref_inv_wording]);
$content = file_get_contents('./tmp/cache/'.$this->attachment);
$at = $mail->createAttachment($content);
$at->type = 'application/pdf';
$at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
$at->filename = $this->attachment;
}
// Send e-mail through SMTP
try {
$mail->send($transport);
} catch(Zend_Mail_Protocol_Exception $e) {
echo '<strong>Zend Mail Protocol Exception:</strong> ' . $e->getMessage();
exit;
}
// Remove temp invoice
unlink("./tmp/cache/$this->attachment");
switch ($this->format)
{
case "invoice":
{
// Create succes message
$message = "<meta http-equiv=\"refresh\" content=\"2;URL=index.php?module=invoices&view=manage\">";
$message .= "<br />$this->attachment has been emailed";
break;
}
case "statement":
{
// Create succes message
$message = "<meta http-equiv=\"refresh\" content=\"2;URL=index.php?module=statement&view=index\">";
$message .= "<br />$this->attachment has been emailed";
break;
}
case "cron":
{
// Create succes message
$message .= "<br />Cron email for today has been sent";
break;
}
case "cron_invoice":
{
// Create succes message
$message .= "$this->attachment has been emailed";
break;
}
}
//.........这里部分代码省略.........
示例10: _sendMail
protected function _sendMail($to, $toname, $subject, $message)
{
$emailconfig = $this->_loadXml('email.xml');
if (!is_null($emailconfig)) {
if ((string) $emailconfig->content) {
$contentType = trim((string) $emailconfig->content);
}
if ((string) $emailconfig->senderemail) {
$senderEmail = (string) $emailconfig->senderemail;
}
if ((string) $emailconfig->sendername) {
$senderName = (string) $emailconfig->sendername;
}
if ((string) $emailconfig->smtp->server) {
$mailServer = (string) $emailconfig->smtp->server;
}
if ((string) $emailconfig->smtp->port) {
$serverPort = (string) $emailconfig->smtp->port;
}
if ((string) $emailconfig->smtp->username) {
$username = (string) $emailconfig->smtp->username;
}
if ((string) $emailconfig->smtp->password) {
$password = (string) $emailconfig->smtp->password;
}
if ((string) $emailconfig->smtp->security) {
$security = (string) $emailconfig->smtp->security;
}
if ((string) $emailconfig->smtp->auth) {
$auth = (string) $emailconfig->smtp->auth;
}
/*
$config = array('auth' => $auth,
'username' => $username,
'password' => $password,
'ssl' => $security,
'port' => $serverPort);
*/
$config = array('auth' => $auth, 'username' => $username, 'password' => $password, 'port' => $serverPort);
if ($security != 'none') {
$config['ssl'] = $security;
}
if ($auth == 'none') {
$transport = new Zend_Mail_Transport_Smtp($mailServer);
} else {
$transport = new Zend_Mail_Transport_Smtp($mailServer, $config);
}
$mail = new Zend_Mail('utf-8');
$mail->setFrom($senderEmail, $senderName);
$mail->addTo($to, $toname);
$mail->setSubject($subject);
if ($contentType == "plain") {
$mail->setBodyText($message);
} else {
$mail->setBodyHTML($message);
}
try {
$mail->send($transport);
} catch (Exception $e) {
Mage::logException($e);
return false;
}
} else {
Mage::log("SMTP configuration not found");
}
}
示例11: send
public function send()
{
$_helper = Mage::helper('smtppro');
// if we have a valid queue page size override, use it
if (is_numeric($_helper->getQueuePerCron()) && intval($_helper->getQueuePerCron()) > 0) {
$percron = $_helper->getQueuePerCron();
$_helper->log('SMTP Pro using queue override page size: ' . $percron);
} else {
$percron = self::MESSAGES_LIMIT_PER_CRON_RUN;
}
$pauseMicros = 0;
// if we have a valid pause, use it
if (is_numeric($_helper->getQueuePause()) && intval($_helper->getQueuePause()) > 0) {
$pauseMicros = $_helper->getQueuePause() * 1000;
// * 1000 for millis => micros
$_helper->log('SMTP Pro using queue override pause: ' . $pauseMicros);
}
/** @var $collection Mage_Core_Model_Resource_Email_Queue_Collection */
$collection = Mage::getModel('core/email_queue')->getCollection()->addOnlyForSendingFilter()->setPageSize($percron)->setCurPage(1)->load();
ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
/** @var $message Mage_Core_Model_Email_Queue */
foreach ($collection as $message) {
if ($message->getId()) {
$parameters = new Varien_Object($message->getMessageParameters());
if ($parameters->getReturnPathEmail() !== null) {
$mailTransport = new Zend_Mail_Transport_Sendmail("-f" . $parameters->getReturnPathEmail());
Zend_Mail::setDefaultTransport($mailTransport);
}
$mailer = new Zend_Mail('utf-8');
foreach ($message->getRecipients() as $recipient) {
list($email, $name, $type) = $recipient;
switch ($type) {
case self::EMAIL_TYPE_BCC:
$mailer->addBcc($email, '=?utf-8?B?' . base64_encode($name) . '?=');
break;
case self::EMAIL_TYPE_TO:
case self::EMAIL_TYPE_CC:
default:
$mailer->addTo($email, '=?utf-8?B?' . base64_encode($name) . '?=');
break;
}
}
if ($parameters->getIsPlain()) {
$mailer->setBodyText($message->getMessageBody());
} else {
$mailer->setBodyHTML($message->getMessageBody());
}
$mailer->setSubject('=?utf-8?B?' . base64_encode($parameters->getSubject()) . '?=');
$mailer->setFrom($parameters->getFromEmail(), $parameters->getFromName());
if ($parameters->getReplyTo() !== null) {
$mailer->setReplyTo($parameters->getReplyTo());
}
if ($parameters->getReturnTo() !== null) {
$mailer->setReturnPath($parameters->getReturnTo());
}
foreach (Mage::app()->getStores() as $store) {
if ($parameters->getFromEmail() == Mage::getStoreConfig('trans_email/ident_sales/email', $store->getStoreId())) {
$storeid = $store->getStoreId();
}
}
try {
$transport = new Varien_Object();
Mage::dispatchEvent('aschroder_smtppro_queue_before_send', array('mail' => $mailer, 'transport' => $transport, 'message' => $message, 'store_id' => isset($storeid) ? $storeid : null));
if ($transport->getTransport()) {
// if set by an observer, use it
$mailer->send($transport->getTransport());
} else {
$mailer->send();
}
unset($mailer);
$message->setProcessedAt(Varien_Date::formatDate(true));
$message->save();
// loop each email to fire an after send event
foreach ($message->getRecipients() as $recipient) {
list($email, $name, $type) = $recipient;
Mage::dispatchEvent('aschroder_smtppro_after_send', array('to' => $email, 'template' => "queued email", 'subject' => $parameters->getSubject(), 'html' => !$parameters->getIsPlain(), 'email_body' => $message->getMessageBody()));
}
} catch (Exception $e) {
unset($mailer);
$oldDevMode = Mage::getIsDeveloperMode();
Mage::setIsDeveloperMode(true);
Mage::logException($e);
Mage::setIsDeveloperMode($oldDevMode);
return false;
}
// after each valid message has been sent - pause if required
if ($pauseMicros > 0) {
$_helper->log('SMTP Pro pausing.');
usleep($pauseMicros);
}
}
}
return $this;
}
示例12: sendTo
public function sendTo()
{
$sendTo = $this->getSendTo();
if (!empty($sendTo)) {
$downloadUrl = Mage::getUrl('amfeed/main/download', array('file' => $this->getFilename() . $this->getFileExt()));
ini_set('SMTP', Mage::getStoreConfig('system/smtp/host'));
ini_set('smtp_port', Mage::getStoreConfig('system/smtp/port'));
$mail = new Zend_Mail('utf-8');
$mail->setBodyHTML("<a href='" . $downloadUrl . "'>" . $this->getFilename() . "</a>");
$mail->setSubject('=?utf-8?B?' . base64_encode($this->getFilename() . " " . Mage::getModel('core/date')->date('Y-m-d H:i:s')) . '?=');
$emails = explode(",", $sendTo);
foreach ($emails as $email) {
$email = trim($email);
if (Zend_Validate::is($email, 'EmailAddress')) {
$mail->addTo($email);
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;
}
}
}
}
}