本文整理汇总了PHP中Zend_Mail::setBodyHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mail::setBodyHtml方法的具体用法?PHP Zend_Mail::setBodyHtml怎么用?PHP Zend_Mail::setBodyHtml使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Mail
的用法示例。
在下文中一共展示了Zend_Mail::setBodyHtml方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
/**
* Send an email.
*
* @param array $params Config object.
* Required keys: to, subject, message
* Optional keys: replyTo
* @param array $viewParams Any values you wish to send to the HTML mail template
* @param array $attachments
* @return bool
*/
public function send(array $params, array $viewParams = array(), $attachments = array())
{
$this->_validateParams($params);
$mail = new Zend_Mail($this->getCharacterEncoding());
$mail->setSubject($params['subject']);
$mail->setBodyText($this->_getPlainBodyText($params));
$mail->setFrom($this->getFromAddress(), $this->getFromName());
$mail->addTo($params['to']);
$viewParams['subject'] = $params['subject'];
if ($this->getHtmlTemplate()) {
$viewParams['message'] = isset($params['message']) ? $params['message'] : '';
$viewParams['htmlMessage'] = isset($params['htmlMessage']) ? $params['htmlMessage'] : '';
$mail->setBodyHtml($this->_renderView($viewParams));
} elseif (isset($params['htmlMessage'])) {
$mail->setBodyHtml($params['htmlMessage']);
}
if (!empty($params['replyTo'])) {
$mail->setReplyTo($params['replyTo']);
}
if (!empty($params['cc'])) {
$mail->addCc($params['cc']);
}
if (!empty($params['bcc'])) {
$mail->addBcc($params['bcc']);
}
$this->addAttachments($attachments);
$mimeParts = array_map(array($this, '_attachmentToMimePart'), $this->_attachments);
array_walk($mimeParts, array($mail, 'addAttachment'));
return $mail->send($this->getTransport());
}
示例2: 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);
}
示例3: 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();
}
示例4: 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);
}
示例5: 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;
}
示例6: indexAction
public function indexAction()
{
$helper = Mage::helper('multipledeals');
$storeId = Mage::app()->getStore()->getId();
if ($helper->isEnabled()) {
//Mage::getModel('multipledeals/multipledeals')->refreshDeals();
if ($mainDeal = $helper->getDeal()) {
$product = Mage::getModel('catalog/product')->setStore($storeId)->load($mainDeal->getProductId());
$product->setDoNotUseCategoryId(true);
$this->_redirectUrl($product->getProductUrl());
return;
} else {
if (Mage::getStoreConfig('multipledeals/configuration/notify')) {
$subject = Mage::helper('multipledeals')->__('There are no deals setup at the moment.');
$content = Mage::helper('multipledeals')->__('A customer tried to view the deals page.');
$replyTo = Mage::getStoreConfig('trans_email/ident_general/email', $storeId);
$mail = new Zend_Mail();
$mail->setBodyHtml($content);
$mail->setFrom($replyTo);
$mail->addTo(Mage::getStoreConfig('multipledeals/configuration/admin_email'));
$mail->setSubject($subject);
$mail->send();
}
$this->_redirect('multipledeals/index/list');
}
} else {
$this->_redirect('no-route');
}
}
示例7: envia
/**
* Método Responsável pelo Envio
* @return boolean
* @throws Zend_Mail_Exception
*/
public function envia()
{
try {
//$oConteudoEmail = $this->oViewEmail->setScriptPath ($this->sTemplate);
//if (isset($this->oDadosView->oArquivoAnexo)) {
//
// $this->oEmail->createAttachment ($this->getArquivoAnexo());
//}
$sConteudoEmail = $this->oViewEmail->render(APPLICATION_PATH . '/../public/templates/' . $this->getTemplate());
if ($this->getConfiguracaoEmail()->formato == 'html') {
$this->oEmail->setBodyHtml($sConteudoEmail);
} else {
$this->oEmail->setBodyText($sConteudoEmail);
}
$this->oEmail->setFrom($this->oViewEmail->sEmailOrigem, $this->oViewEmail->sNomeOrigem);
$this->oEmail->setReplyTo($this->oViewEmail->sEmailOrigem, $this->oViewEmail->sNomeOrigem);
$this->oEmail->addTo($this->oViewEmail->sEmailDestino, $this->oViewEmail->sNomeDestino);
$this->oEmail->setSubject($this->oViewEmail->sAssunto);
$this->oEmail->send($this->getMetodoTransporte());
$oRetorno->mensage = self::SUCESSO_ENVIO;
$oRetorno->status = true;
return $oRetorno;
} catch (Zend_Mail_Exception $oErro) {
throw new Zend_Mail_Exception($oErro);
}
}
示例8: init
public function init()
{
$this->model = new ContactUsForm();
if (isset($_POST['ContactUsForm'])) {
$this->model->attributes = $_POST['ContactUsForm'];
if ($this->model->validate()) {
$this->successMessage = 'Your message has been sent, thank you';
try {
include_once "Zend/Mail.php";
$contactName = strip_tags($this->model->name);
$staffMessage = "Name:\t" . $contactName . "\n" . "Tel:\t" . $this->model->telephone . "\n" . "Email:\t" . $this->model->email . "\n" . "Message:\n" . $this->model->message . "\n\n" . "Sent:\t" . date("d/m/Y H:i");
$mailToStaff = new Zend_Mail("UTF-8");
$mailToStaff->addTo($this->model->to . Yii::app()->params['contactUs']['email_hostname']);
$mailToStaff->setFrom($this->model->to . Yii::app()->params['contactUs']['email_hostname']);
$mailToStaff->setSubject("Message posted from Wooster & Stock Contact Page");
$mailToStaff->setBodyText($staffMessage);
$mailToStaff->send();
$mailToClient = new Zend_Mail('UTF-8');
$mailToClient->addTo($this->model->email, $contactName);
$mailToClient->setFrom($this->model->to . Yii::app()->params['contactUs']['email_hostname']);
$mailToClient->setSubject("Message posted from Wooster & Stock Contact Page");
$mailToClient->setBodyText($this->emailText('text', $this->model->email, $contactName));
$mailToClient->setBodyHtml($this->emailText('html', $this->model->email, $contactName));
$mailToClient->send();
} catch (Exception $e) {
}
$this->model->unsetAttributes();
}
}
}
示例9: 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;
}
示例10: 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);
}
}
}
示例11: 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();
}
示例12: processRegisterAction
/**
* Process Register action
*/
public function processRegisterAction()
{
$db = $this->db;
$form = new Owner_Registration();
if ($this->_request->isXmlHttpRequest() && $form->isValid($_POST)) {
$data = $form->getValidValues($_POST);
//mark as free trial
$data["free_trial"] = 1;
$newRecord = $this->ownerModel->create($data);
//query newly create record
$owner = $this->ownerModel->find($newRecord)->toArray();
try {
//sends an email
$mail = new Zend_Mail("utf-8");
$mail->addTo($owner["email"], $owner["first_name"] . " " . $owner["last_name"]);
$mail->setBodyHtml(Mailer::getTemplate("welcome.phtml", array("fullname" => $owner["first_name"] . " " . $owner["last_name"])));
$mail->setSubject("welcome to Leadschat");
$mail->setFrom("noreply@leadschat.com");
$mail->send(Mailer::getTransport());
} catch (Exception $e) {
}
$this->view->result = array("result" => true);
} else {
$this->view->result = array("result" => false, "errors" => $form->getErrors());
}
$this->_helper->layout->setLayout("plain");
$this->_helper->viewRenderer("json");
}
示例13: sendEmail
public function sendEmail($template, $to, $subject, $params = array())
{
try {
$config = array('auth' => 'Login', 'port' => $this->_bootstrap_options['mail']['port'], 'ssl' => 'ssl', 'username' => $this->_bootstrap_options['mail']['username'], 'password' => $this->_bootstrap_options['mail']['password']);
$tr = new Zend_Mail_Transport_Smtp($this->_bootstrap_options['mail']['server'], $config);
Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail('UTF-8');
$layout = new Zend_Layout();
$layout->setLayoutPath($this->_bootstrap_options['mail']['layout']);
$layout->setLayout('email');
$view = $layout->getView();
$view->domain_url = $this->_bootstrap_options['site']['domainurl'];
$view = new Zend_View();
$view->params = $params;
$view->setScriptPath($this->_bootstrap_options['mail']['view_script']);
$layout->content = $view->render($template . '.phtml');
$content = $layout->render();
$mail->setBodyText(preg_replace('/<[^>]+>/', '', $content));
$mail->setBodyHtml($content);
$mail->setFrom($this->_bootstrap_options['mail']['from'], $this->_bootstrap_options['mail']['from_name']);
$mail->addTo($to);
$mail->setSubject($subject);
$mail->send();
} catch (Exception $e) {
// 这里要完善
}
return true;
}
示例14: apkisgeneratedAction
public function apkisgeneratedAction()
{
$appName = $this->getRequest()->getParam('app_name');
$apk_base_path = Core_Model_Directory::getBasePathTo("var/tmp/applications/android/{$appName}/Siberian/app/build/outputs/apk/app-release.apk");
$apk_path = Core_Model_Directory::getPathTo("var/tmp/applications/android/{$appName}/Siberian/app/build/outputs/apk/app-release.apk");
$apk_is_generated = false;
$link = $this->getUrl() . $apk_path;
$link = str_replace("//", "/", $link);
if (file_exists($apk_base_path)) {
if (time() - filemtime($apk_base_path) <= 600) {
$apk_is_generated = true;
}
}
$user = new Backoffice_Model_User();
try {
$user = $user->findAll(null, "user_id ASC", array("limit" => "1"))->current();
$sender = System_Model_Config::getValueFor("support_email");
$support_name = System_Model_Config::getValueFor("support_name");
$layout = $this->getLayout()->loadEmail('application', 'download_source');
$subject = $this->_('Android APK Generation');
$layout->getPartial('content_email')->setLink($link);
$layout->getPartial('content_email')->setApkStatus($apk_is_generated);
$content = $layout->render();
$mail = new Zend_Mail('UTF-8');
$mail->setBodyHtml($content);
$mail->setFrom($sender, $support_name);
$mail->addTo($user->getEmail());
$mail->setSubject($subject);
$mail->send();
} catch (Exception $e) {
$logger = Zend_Registry::get("logger");
$logger->sendException("Fatal Error Sending the APK Generation Email: \n" . print_r($e, true), "apk_generation_");
}
die('ok');
}
示例15: sendAction
/**
* Action send.
*
* @return void
*/
public function sendAction()
{
$form = new Application_Form_Forgot();
$tableUser = new Tri_Db_Table('user');
$data = $this->_getAllParams();
if ($form->isValid($data)) {
$email = $this->_getParam('email');
$user = $tableUser->fetchRow(array('email = ?' => $email));
if (!$user->id) {
$this->_helper->_flashMessenger->addMessage('user not avaliable');
$this->_redirect('forgot/');
}
$this->view->name = $user->name;
$this->view->url = $this->encryptUrl($user);
$mail = new Zend_Mail(APP_CHARSET);
$mail->setBodyHtml($this->view->render('forgot/mail.phtml'));
$mail->setFrom(FROM_EMAIL, FROM_NAME);
$mail->setSubject($this->view->translate('forgot'));
$mail->addTo($user->email, $user->name);
$mail->send();
$this->_helper->_flashMessenger->addMessage('Success');
$this->_redirect('forgot/');
}
$this->_helper->_flashMessenger->addMessage('Error');
$this->_redirect('forgot/');
}