本文整理汇总了PHP中Zend_Mail::setReplyTo方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Mail::setReplyTo方法的具体用法?PHP Zend_Mail::setReplyTo怎么用?PHP Zend_Mail::setReplyTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Mail
的用法示例。
在下文中一共展示了Zend_Mail::setReplyTo方法的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: ceospeaksAction
public function ceospeaksAction()
{
$request = $this->getRequest();
if ($request->isPost()) {
// action body
$emails_str = str_replace(" ", "", $request->getParam('emails'));
// strips whitespace from string
$emails = explode(",", $emails_str);
// splits string into an array using comma to split
$validator = new Zend_Validate_EmailAddress();
foreach ($emails as $email) {
if (!$validator->isValid($email)) {
array_shift($emails);
// Remove invalid emails
}
}
$mail = new Zend_Mail();
$mail->setFrom('suggestions@winsandwants.com', 'winsandwants.com');
$mail->setReplyTo('suggestions@winsandwants.com', 'winsandwants.com');
$mail->addTo($emails);
$mail->setSubject('Sharing winsandwants.com');
$txt = "A friend would like to share with you this wonderful free site on goal-setting and the mastermind concept. Please visit: http://winsandwants.com";
$mail->setBodyText($txt, 'UTF-8');
$mail->send();
$this->view->msg = "Thank you for sharing this site. A link to this site has been sent to the following emails: " . implode(",", $emails) . ".";
}
}
示例3: 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);
}
}
示例4: 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();
}
}
}
}
示例5: 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;
}
示例6: sendEmail
public function sendEmail($data)
{
$mail = new Zend_Mail("utf-8");
$mail->setFrom($data["nm_email"], $data["nm_nome"]);
$mail->setReplyTo($data["nm_email"], $data["nm_nome"]);
$mail->setSubject("[Contato - DR. ANDRE MARINHO]: " . $data["nm_nome"]);
$mail->setBodyHtml($this->getBodyHtml($data));
$mail->addTo("contato@drandremarinho.com.br");
return $mail->send();
}
示例7: init
public function init()
{
if (isset($_POST[$this->name]['send'])) {
file_put_contents(Yii::app()->params['logDirPath'] . '/post.log', print_r($_POST, true), FILE_APPEND);
$postData = $_POST[$this->name];
$name = $postData['name'];
$email = $postData['email'];
$address = $postData['address'];
$tel = $postData['tel'];
$type = $postData['type'];
$dateTime = $postData['date'];
$dateTime .= isset($postData['time']) ? ' ' . $postData['time'] : '';
if (!$name) {
$this->errors[$this->name]['name'] = 'Name';
}
if (!$email || !filter_var($email, FILTER_VALIDATE_EMAIL)) {
$this->errors[$this->name]['email'] = 'Email';
}
if (!$address) {
$this->errors[$this->name]['address'] = 'Address';
}
if ($this->errors) {
$msg = 'In order for us to deal with your enquiry please provide the following info...';
$msg = $msg . '<ul class="horizontal"><li>';
$msg = $msg . implode("</li><li>", $this->errors[$this->name]);
$msg = $msg . "</li></ul>";
$this->errorMessage = $msg;
} else {
$this->successMessage = 'Your message has been sent, thank you';
try {
include_once "Zend/Mail.php";
$contactName = strip_tags($name);
$staffMessage = "Name:\t" . $contactName . "\n" . "Tel:\t" . $tel . "\n" . "Email:\t" . $email . "\n" . "Type:\n" . $type . "\n\n" . "Address:\n" . $address . "\n\n" . "Preffered date/time:\n" . $dateTime . "\n\n" . "Sent:\t" . date("d/m/Y H:i");
$mailToStaff = new Zend_Mail("UTF-8");
$mailToStaff->addTo(Yii::app()->params['valuation']['email']);
$mailToStaff->setFrom(Yii::app()->params['valuation']['sender']);
$mailToStaff->setSubject("Wooster & Stock Valuation Request");
$mailToStaff->setBodyText($staffMessage);
$mailToStaff->send();
$clientEmail = $email;
$mailToClient = new Zend_Mail('UTF-8');
$mailToClient->addTo($clientEmail, $contactName);
$mailToClient->setFrom(Yii::app()->params['valuation']['sender']);
$mailToClient->setReplyTo(Yii::app()->params['valuation']['replyTo']);
$mailToClient->setSubject("Wooster & Stock Valuation Request");
$mailToClient->setBodyText($this->emailText('text', $clientEmail, $contactName));
$mailToClient->setBodyHtml($this->emailText('html', $clientEmail, $contactName));
$mailToClient->send();
} catch (Exception $e) {
}
unset($_POST[$this->name]);
}
}
}
示例8: send
/**
* send email using smtp.gmail.com
* @param array $options for sending mail
* @return boolean
*/
public static function send($options)
{
$body = '';
$config = Zend_Registry::get('smtpConfig');
if (isset($options['from']['email']) && $options['from']['email'] != '') {
$fromAddress = $options['from']['email'];
} else {
$fromAddress = $config->fromAddress;
}
if ($config->isSendMails == true) {
if (!empty($options['template']) && file_exists(APPLICATION_PATH . $options['template'])) {
$template = new App_File(APPLICATION_PATH . $options['template']);
$body = $template->contents;
if (is_array($options['additional'])) {
foreach ($options['additional'] as $key => $value) {
$body = str_replace('{' . $key . '}', $value, $body);
}
}
if (is_array($options['data'])) {
foreach ($options['data'] as $key => $value) {
$body = str_replace('{' . $key . '}', $value, $body);
}
}
} else {
$body = $options['body'];
}
$smtpConfig = array('ssl' => $config->ssl, 'port' => $config->port, 'auth' => $config->auth, 'username' => $config->username, 'password' => $config->password);
$transport = new Zend_Mail_Transport_Smtp($config->host, $smtpConfig);
$mail = new Zend_Mail('utf-8');
$mail->setBodyHtml($body);
$mail->setFrom($config->fromAddress, $config->fromName);
$mail->setReplyTo($fromAddress, $config->fromName);
//if (APPLICATION_ENV == 'production') {
foreach ($options['to'] as $to) {
$to['label'] = empty($to['label']) ? $to['email'] : $to['label'];
$mail->addTo($to['email'], $to['label']);
}
//} else {
//$mail->addTo($config->toAddress, $config->toName);
//}
if (isset($options['bcc']['email']) && !empty($options['bcc']['email'])) {
$mail->addBcc($options['bcc']['email']);
}
$mail->setSubject($options['subject']);
try {
$mail->send($transport);
return true;
} catch (Zend_Exception $e) {
return $e->getMessage();
}
}
return false;
}
示例9: setReplyTo
public function setReplyTo($email, $name = null)
{
if (null !== $this->_replyTo) {
throw new Zend_Mail_Exception('Reply-To Header set twice');
}
// ordering is important here because of difference between zend mail in different version of magento
parent::setReplyTo($email, $name);
if (!$this->_replyTo) {
$this->_replyTo = $this->_filterEmail($email);
}
return $this;
}
示例10: sendMail
/**
* Sends contact email
*/
private function sendMail($subject, $message, $fromName, $fromEmail)
{
$mail = new Zend_Mail('UTF-8');
$mail->addTo('goreanski@gmail.com');
$mail->addBcc('iaroslav.svet@gmail.com');
$mail->setSubject($subject);
$mail->setBodyText($message . PHP_EOL . 'Sender IP: ' . $_SERVER['REMOTE_ADDR']);
$mail->setFrom('mailer@umkus.com', 'Unsee.cc');
$mail->setReplyTo($fromEmail, $fromName);
$mail->setDefaultTransport(new Zend_Mail_Transport_Sendmail());
try {
return $mail->send();
} catch (Exception $e) {
}
}
示例11: enviar
public function enviar()
{
$settings = array('ssl' => 'ssl', 'port' => 465, 'auth' => 'login', 'username' => 'aptus.noreply@gmail.com', 'password' => 'aptus@aptus');
$transport = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $settings);
$email_from = "aptus.noreply@gmail.com";
$name_from = "Aptus - Gestao em Saude";
$email_to = $this->destinatario['email'];
$name_to = $this->destinatario['nome'];
$mail = new Zend_Mail();
$mail->setReplyTo($email_from, $name_from);
$mail->setFrom($email_from, $name_from);
$mail->addTo($email_to, $name_to);
$mail->setSubject($this->assunto);
$mail->setBodyText($this->mensagem);
$mail->send($transport);
}
示例12: handle
/**
* @param string $fromTitle
* @param string $fromMail
* @param string $toEmail
* @param array $recipientCC
* @param array $recipientBCC
* @param string $subject
* @param string $body
* @param string $attachments
* @param string $smtpHost
* @param string $smtpPort
* @param string $serverLogin
* @param string $serverPassword
* @param string $charCode
* @param boolean $isHtml
* @return type
*/
public function handle($fromTitle, $fromMail, $toEmail, array $recipientCC, array $recipientBCC, $subject, $body, $attachments, $smtpHost = null, $smtpPort = null, $serverLogin = null, $serverPassword = null, $charCode = 'UTF-8', $isHtml = false, $replyto = null)
{
if ($smtpHost) {
$params = array('name' => 'ZendMailHandler', 'port' => $smtpPort);
if ($serverLogin) {
$params['auth'] = 'login';
$params['username'] = $serverLogin;
$params['password'] = $serverPassword;
}
$transport = new Zend_Mail_Transport_Smtp($smtpHost, $params);
} else {
$transport = new Zend_Mail_Transport_Sendmail(array('name' => 'ZendMailHandler'));
}
$mail = new Zend_Mail($charCode);
$mail->setFrom($fromMail, $fromTitle)->addTo($toEmail)->setSubject($subject);
if (!empty($recipientCC)) {
$mail->addCc($recipientCC);
}
if (!empty($recipientBCC)) {
$mail->addBcc($recipientBCC);
}
//$mail->setReturnPath($replyto);
if (!empty($replyto)) {
$mail->setReplyTo($replyto);
}
if ($isHtml) {
$mail->setBodyHtml($body);
} else {
$mail->setBodyText($body);
}
if (is_object($attachments) && $attachments->areAttachments()) {
$mail->setType(Zend_Mime::MULTIPART_RELATED);
$attachments->handle($mail);
}
if ($mail->send($transport)) {
return true;
} else {
return false;
}
}
示例13: registerAction
public function registerAction()
{
if (Zend_Auth::getInstance()->hasIdentity()) {
$this->_helper->redirector('index', 'index', 'default');
}
$form = new Application_Form_Register();
$this->view->form = $form;
$validator = new Zend_Validate_Db_NoRecordExists(array('table' => 'users', 'field' => 'email'));
if ($this->getRequest()->isPost()) {
$formData = $this->getRequest()->getPost();
if ($form->isValid($formData)) {
$email = $this->getRequest()->getPost('email');
if ($validator->isValid($email)) {
$username = $this->getRequest()->getPost('login');
$password = $this->getRequest()->getPost('pass');
$date = time();
$user = new Application_Model_DbTable_User();
$result = $user->addUser($username, md5($password), $email, $date);
$message = "Вы успешно зарегистрировались на сайте Serializm.com.\r\nЛогин: " . $username . "\r\nПароль: " . $password . "\r\nС уважением, Администрация Serializm.com";
$transport = new Zend_Mail_Transport_Smtp();
Zend_Mail::setDefaultTransport($transport);
$mail = new Zend_Mail('utf-8');
$mail->setReplyTo('admin@serializm.com', 'Администратор');
$mail->addHeader('MIME-Version', '1.0');
$mail->addHeader('Content-Transfer-Encoding', '8bit');
$mail->addHeader('X-Mailer:', 'PHP/' . phpversion());
$mail->setBodyText($message);
$mail->setFrom('admin@serializm.com', 'Администратор');
$mail->addTo($email);
$mail->setSubject('Успешная регистрация на serializm.com');
$mail->send();
if ($result) {
$this->_helper->redirector('index', 'index', 'default');
}
} else {
$this->view->errMessage = $validator->getMessages();
}
}
}
}
示例14: send
public static function send($email, $name, $subject, $view, $data, $containerViewFile = 'mail')
{
self::init();
if (is_object($data)) {
$data->email = $email;
$data->subject = $subject;
} else {
if (is_array($data)) {
$data['email'] = $email;
$data['subject'] = $subject;
} else {
$data = array();
$data['email'] = $email;
$data['subject'] = $subject;
}
}
if (Settings::get(Settings::DEBUG, false) && Settings::get(self::TEST_MAIL, '') != '') {
$email = Settings::get(self::TEST_MAIL, '');
}
$html = self::preview($view, $data, $containerViewFile, false);
$text = trim(self::preview($view, $data, $containerViewFile, true));
if (String::isHtml($text) || $text == '') {
$text = T("This is an HTML message. Please use a HTML capable mail program to read this message.");
}
$mail = new Zend_Mail(Settings::get(Settings::ENCODING));
$fromName = Settings::get(self::FROM_NAME);
$fromMail = Settings::get(self::FROM_MAIL);
$mail->setFrom($fromMail, $fromName);
$mail->setReplyTo(Settings::get(self::REPLY_MAIL, $fromMail), $fromName);
$mail->setReturnPath(Settings::get(self::RETURN_MAIL, $fromMail), $fromName);
$mail->setSubject($subject);
$mail->setBodyHtml($html);
$mail->addTo($email, $name);
$mail->setBodyText($text);
if (Settings::get(self::SELF_EMAIL, false)) {
$mail->addBcc(Settings::get(self::SELF_EMAIL));
}
$mail->send();
}
示例15: SEND_SMTP_ZEND
private function SEND_SMTP_ZEND()
{
try {
loadLibrary("ZEND", "Zend_Mail");
loadLibrary("ZEND", "Zend_Mail_Transport_Smtp");
if (empty($this->MailText)) {
$this->MailText = ">>";
}
if ($this->Account->Authentication == "No") {
$config = array('port' => $this->Account->Port);
} else {
$config = array('auth' => 'login', 'username' => $this->Account->Username, 'password' => $this->Account->Password, 'port' => $this->Account->Port);
}
if (!empty($this->Account->SSL)) {
$config['ssl'] = $this->Account->SSL == 1 ? 'SSL' : 'TLS';
}
$transport = new Zend_Mail_Transport_Smtp($this->Account->Host, $config);
$mail = new Zend_Mail('UTF-8');
$mail->setBodyText($this->MailText);
if (empty($this->FakeSender)) {
$mail->setFrom($this->Account->Email, $this->Account->SenderName);
} else {
$mail->setFrom($this->FakeSender, $this->FakeSender);
}
if (strpos($this->Receiver, ",") !== false) {
$emails = explode(",", $this->Receiver);
$add = false;
foreach ($emails as $mailrec) {
if (!empty($mailrec)) {
if (!$add) {
$add = true;
$mail->addTo($mailrec, $mailrec);
} else {
$mail->addBcc($mailrec, $mailrec);
}
}
}
} else {
$mail->addTo($this->Receiver, $this->Receiver);
}
$mail->setSubject($this->Subject);
$mail->setReplyTo($this->ReplyTo, $name = null);
if ($this->Attachments != null) {
foreach ($this->Attachments as $resId) {
$res = getResource($resId);
$at = $mail->createAttachment(file_get_contents("./uploads/" . $res["value"]));
$at->type = 'application/octet-stream';
$at->disposition = Zend_Mime::DISPOSITION_ATTACHMENT;
$at->encoding = Zend_Mime::ENCODING_BASE64;
$at->filename = $res["title"];
}
}
$mail->send($transport);
} catch (Exception $e) {
if ($this->TestIt) {
throw $e;
} else {
handleError("111", $this->Account->Host . " send mail connection error: " . $e->getMessage(), "functions.global.inc.php", 0);
}
return 0;
}
return 1;
}