本文整理汇总了PHP中CakeEmail::returnPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeEmail::returnPath方法的具体用法?PHP CakeEmail::returnPath怎么用?PHP CakeEmail::returnPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CakeEmail
的用法示例。
在下文中一共展示了CakeEmail::returnPath方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareFromAddress
/**
* Prepares the `from` email address.
*
* @return array
*/
protected function _prepareFromAddress()
{
$from = $this->_cakeEmail->returnPath();
if (empty($from)) {
$from = $this->_cakeEmail->from();
}
return $from;
}
示例2: _sendRcpt
/**
* Send emails
*
* @return void
* @throws SocketException
*/
protected function _sendRcpt()
{
$from = $this->_cakeEmail->returnPath();
if (empty($from)) {
$from = $this->_cakeEmail->from();
}
$this->_smtpSend('MAIL FROM:<' . key($from) . '>');
$to = $this->_cakeEmail->to();
$cc = $this->_cakeEmail->cc();
$bcc = $this->_cakeEmail->bcc();
$emails = array_merge(array_keys($to), array_keys($cc), array_keys($bcc));
foreach ($emails as $email) {
$this->_smtpSend('RCPT TO:<' . $email . '>');
}
}
示例3: accountCompleteMail
public static function accountCompleteMail($user)
{
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail();
$email->config('default');
$email->domain('nativecamp.net');
$email->emailFormat('text');
$email->template('account_complete');
$email->viewVars(array('name' => $user['nickname']));
$email->to($user['email']);
$email->from('info@nativecamp.net', 'NativeCamp運営事務局');
$email->replyTo('info@nativecamp.net');
$email->returnPath('info@nativecamp.net', 'NativeCamp運営事務局');
# $email->subject(__('Account Activation').' - '.Configure::read('my.site_name'));
$email->subject("ネイティブキャンプ:事前登録完了メール");
$email->send();
}
示例4: send
/**
* Send
*
* A bit of a misnomer, because this actually just adds it to a CakeResque
* queue. The actual sending of the email will be performed later by a worker.
*
* @params CakeEmail $email
* @return array
*/
public function send(CakeEmail $email)
{
// Take a copy of the existing configuration.
$config = array('headers' => $email->getHeaders(), 'from' => $email->from(), 'sender' => $email->sender(), 'replyTo' => $email->replyTo(), 'readReceipt' => $email->readReceipt(), 'returnPath' => $email->returnPath(), 'to' => $email->to(), 'cc' => $email->cc(), 'bcc' => $email->bcc(), 'subject' => $email->subject(), 'viewRender' => $email->viewRender(), 'viewVars' => $email->viewVars(), 'emailFormat' => $email->emailFormat(), 'messageId' => $email->messageId(), 'attachments' => $email->attachments());
// unset($config['config']['transport']);
$template = $email->template();
$config['template'] = $template['template'];
$config['layout'] = $template['layout'];
// Clean it up to avoid errors.
$config = array_filter($config, function ($v) {
return (bool) $v;
});
debug($config);
// Include a message, if they sent one via plain text.
$message = $email->message(CakeEmail::MESSAGE_HTML) ? null : $email->message(CakeEmail::MESSAGE_TEXT);
// Drop it in a queue.
Resque::enqueue('email', 'ResqueEmail.EmailShell', array('send', $config, $message));
return array('headers' => $email->getHeaders(), 'message' => $email->message());
}
示例5: send
/**
* Send an email using the specified content, template and layout
*
* @param string|array $content Either an array of text lines, or a string with contents
* If you are rendering a template this variable will be sent to the templates as `$content`
* @param string $template Template to use when sending email
* @param string $layout Layout to use to enclose email body
* @return boolean Success
*/
public function send($content = null, $template = null, $layout = null) {
$lib = new CakeEmail();
$lib->charset = $this->charset;
$lib->headerCharset = $this->charset;
$lib->from($this->_formatAddresses((array)$this->from));
if (!empty($this->to)) {
$lib->to($this->_formatAddresses((array)$this->to));
}
if (!empty($this->cc)) {
$lib->cc($this->_formatAddresses((array)$this->cc));
}
if (!empty($this->bcc)) {
$lib->bcc($this->_formatAddresses((array)$this->bcc));
}
if (!empty($this->replyTo)) {
$lib->replyTo($this->_formatAddresses((array)$this->replyTo));
}
if (!empty($this->return)) {
$lib->returnPath($this->_formatAddresses((array)$this->return));
}
if (!empty($this->readReceipt)) {
$lib->readReceipt($this->_formatAddresses((array)$this->readReceipt));
}
$lib->subject($this->subject)->messageID($this->messageId);
$lib->helpers($this->_controller->helpers);
$headers = array('X-Mailer' => $this->xMailer);
foreach ($this->headers as $key => $value) {
$headers['X-' . $key] = $value;
}
if ($this->date) {
$headers['Date'] = $this->date;
}
$lib->setHeaders($headers);
if ($template) {
$this->template = $template;
}
if ($layout) {
$this->layout = $layout;
}
$lib->template($this->template, $this->layout)->viewVars($this->_controller->viewVars)->emailFormat($this->sendAs);
if (!empty($this->attachments)) {
$lib->attachments($this->_formatAttachFiles());
}
$lib->transport(ucfirst($this->delivery));
if ($this->delivery === 'mail') {
$lib->config(array('eol' => $this->lineFeed, 'additionalParameters' => $this->additionalParams));
} elseif ($this->delivery === 'smtp') {
$lib->config($this->smtpOptions);
} else {
$lib->config(array());
}
$sent = $lib->send($content);
$this->htmlMessage = $lib->message(CakeEmail::MESSAGE_HTML);
if (empty($this->htmlMessage)) {
$this->htmlMessage = null;
}
$this->textMessage = $lib->message(CakeEmail::MESSAGE_TEXT);
if (empty($this->textMessage)) {
$this->textMessage = null;
}
$this->_header = array();
$this->_message = array();
return $sent;
}
示例6: testRcptWithReturnPath
/**
* testRcptWithReturnPath method
*
* @return void
*/
public function testRcptWithReturnPath()
{
$email = new CakeEmail();
$email->from('noreply@cakephp.org', 'CakePHP Test');
$email->to('cake@cakephp.org', 'CakePHP');
$email->returnPath('pleasereply@cakephp.org', 'CakePHP Return');
$this->socket->expects($this->at(0))->method('write')->with("MAIL FROM:<pleasereply@cakephp.org>\r\n");
$this->socket->expects($this->at(1))->method('read')->will($this->returnValue(false));
$this->socket->expects($this->at(2))->method('read')->will($this->returnValue("250 OK\r\n"));
$this->socket->expects($this->at(3))->method('write')->with("RCPT TO:<cake@cakephp.org>\r\n");
$this->socket->expects($this->at(4))->method('read')->will($this->returnValue(false));
$this->socket->expects($this->at(5))->method('read')->will($this->returnValue("250 OK\r\n"));
$this->SmtpTransport->setCakeEmail($email);
$this->SmtpTransport->sendRcpt();
}
示例7: sendMail
//.........这里部分代码省略.........
}
// 件名
$cakeEmail->subject($title);
//From
$fromName = $from = '';
if (!empty($options['from'])) {
$from = $options['from'];
} else {
if (!empty($this->siteConfigs['email'])) {
$from = $this->siteConfigs['email'];
if (strpos($from, ',') !== false) {
$from = explode(',', $from);
}
} else {
$from = $toAddress;
}
}
if (!empty($options['fromName'])) {
$fromName = $options['fromName'];
} else {
if (!empty($this->siteConfigs['formal_name'])) {
$fromName = $this->siteConfigs['formal_name'];
} else {
$formalName = Configure::read('BcApp.title');
}
}
$cakeEmail->from($from, $fromName);
//Reply-To
if (!empty($options['replyTo'])) {
$replyTo = $options['replyTo'];
} else {
$replyTo = $from;
}
$cakeEmail->replyTo($replyTo);
//Return-Path
if (!empty($options['returnPath'])) {
$returnPath = $options['returnPath'];
} else {
$returnPath = $from;
}
$cakeEmail->returnPath($returnPath);
//$sender
if (!empty($options['sender'])) {
$cakeEmail->sender($options['sender']);
}
//$theme
if ($this->theme) {
$cakeEmail->theme($this->theme);
}
if (!empty($options['theme'])) {
$cakeEmail->theme($options['theme']);
}
//viewRender (利用するviewクラスを設定する)
$cakeEmail->viewRender('BcApp');
//template
if (!empty($options['template'])) {
$layoutPath = $subDir = $plugin = '';
if ($options['agentTemplate'] && Configure::read('BcRequest.agent')) {
$layoutPath = Configure::read('BcRequest.agentPrefix');
$subDir = Configure::read('BcRequest.agentPrefix');
}
list($plugin, $template) = pluginSplit($options['template']);
if ($subDir) {
$template = "{$subDir}/{$template}";
}
if (!empty($plugin)) {
$template = "{$plugin}.{$template}";
}
if (!empty($options['layout'])) {
$cakeEmail->template($template, $options['layout']);
} else {
$cakeEmail->template($template);
}
$content = '';
if (is_array($body)) {
$cakeEmail->viewVars($body);
} else {
$cakeEmail->viewVars(array('body' => $body));
}
} else {
$content = $body;
}
// $attachments tmp file path
$attachments = array();
if (!empty($options['attachments'])) {
if (!is_array($options['attachments'])) {
$attachments = array($options['attachments']);
} else {
$attachments = $options['attachments'];
}
}
$cakeEmail->attachments($attachments);
try {
$cakeEmail->send($content);
return true;
} catch (Exception $e) {
$this->log($e->getMessage());
return false;
}
}
示例8: sendTemplateMail
public static function sendTemplateMail($mail_id, $to_email, $user)
{
App::uses('CakeEmail', 'Network/Email');
App::uses('MailTemplate', 'Model');
// 宛先がない
if (empty($to_email)) {
return;
}
// テンプレート取得
$mailbase = ClassRegistry::init('MailTemplate')->findByIdAndStatus($mail_id, 1);
if (empty($mailbase['MailTemplate'])) {
return;
}
$mail_template = $mailbase['MailTemplate'];
// FROMがない
if (empty($mail_template['from_email'])) {
return;
}
$search = array('/--id--/', '/--nickname--/', '/--email--/');
$replace = array($user['id'], $user['nickname'], $user['email']);
$mail_subject = str_replace($search, $replace, $mail_template['subject']);
$mail_body = str_replace($search, $replace, $mail_template['body']);
switch ($mail_id) {
case Configure::read('site_in_mail.student_changed_email'):
$mail_body = str_replace(array('/--new_email--/', '/--url--/'), array($user['new_email'], $user['active_url']), $mail_body);
break;
case Configure::read('site_in_mail.student_changed_password'):
$mail_body = str_replace(array('/--url--/'), array($user['active_url']), $mail_body);
break;
case Configure::read('site_in_mail.student_reserved'):
case Configure::read('site_in_mail.student_cancel_reservation'):
$mail_body = str_replace(array('/--teacherName--/', '/--appointmentDate--/', '/--startTime--/'), array($user['teacherName'], $user['appointmentDate'], $user['startTime']), $mail_body);
break;
case Configure::read('site_in_mail.admin_student_reserved'):
case Configure::read('site_in_mail.admin_student_cancel'):
$mail_body = str_replace(array('/--teacherName--/', '/--appointmentDate--/', '/--startTime--/', '/--endTime--/'), array($user['teacherName'], $user['appointmentDate'], $user['startTime'], $user['endTime']), $mail_body);
break;
case Configure::read('site_in_mail.teacher_cancel_reservation'):
$mail_body = str_replace(array('/--teacherName--/', '/--appointmentDate--/', '/--startTime--/', '/--endTime--/'), array($user['teacherName'], $user['appointmentDate'], $user['startTime'], $user['endTime']), $mail_body);
break;
case Configure::read('site_in_mail.student_reservedlesson_before_30minutes'):
$mail_body = str_replace(array('/--teacherName--/', '/--appointmentDate--/', '/--startTime--/'), array($user['teacherName'], $user['appointmentDate'], $user['startTime']), $mail_body);
break;
case Configure::read('site_in_mail.admin_reservedlesson_before_30minutes'):
$mail_body = str_replace(array('/--email--/', '/--teacherName--/', '/--appointmentDate--/', '/--startTime--/', '/--endTime--/'), array($user['email'], $user['teacherName'], $user['appointmentDate'], $user['startTime'], $user['endTime']), $mail_body);
break;
case Configure::read('site_in_mail.student_inquiry'):
break;
case Configure::read('site_in_mail.student_inquiry_reply'):
$mail_body = str_replace(array('/--replymessage--/'), array($user['replymessage']), $mail_body);
break;
case Configure::read('site_in_mail.admin_student_inquiry'):
$mail_body = str_replace(array('/--inquiry_message--/'), array($user['inquiry_message']), $mail_body);
break;
case Configure::read('site_in_mail.student_regist_email_confirm'):
$mail_body = str_replace(array('/--url--/'), array($user['active_url']), $mail_body);
break;
case Configure::read('site_in_mail.purchase_book_confirm_user'):
$mail_subject = str_replace('/--books--/', $user['books'], $mail_subject);
$mail_body = str_replace(array('/--tax--/', '/--nickname--/', '/--name--/', '/--address--/', '/--contact--/', '/--email--/', '/--products--/', '/--price--/', '/--quantity--/', '/--subtotal--/', '/--total--/', '/--account--/'), array($user['tax'], $user['nickname'], $user['name'], $user['address'], $user['contact'], $user['email'], $user['products'], $user['price'], $user['qty'], $user['subtotal'], $user['total'], $user['account']), $mail_body);
break;
case Configure::read('site_in_mail.purchase_book_confirm_admin'):
$mail_body = str_replace(array('/--tax--/', '/--name--/', '/--address--/', '/--contact--/', '/--email--/', '/--products--/', '/--price--/', '/--quantity--/', '/--subtotal--/', '/--total--/'), array($user['tax'], $user['name'], $user['address'], $user['contact'], $user['email'], $user['products'], $user['price'], $user['qty'], $user['subtotal'], $user['total']), $mail_body);
break;
}
$email = new CakeEmail();
$email->config('default');
$email->from($mail_template['from_email'], 'NativeCamp運営事務局');
$email->to($to_email);
$email->replyTo('info@nativecamp.net');
$email->returnPath('return@nativecamp.net', 'NativeCamp運営事務局');
$email->subject($mail_subject);
$email->send($mail_body);
}
示例9: _prepareFromAddress
/**
* Prepares the `from` email address.
*
* @param CakeEmail $email CakeEmail
* @return array
*/
protected function _prepareFromAddress(CakeEmail $email)
{
$from = $email->returnPath();
if (empty($from)) {
$from = $email->from();
}
return $from;
}
示例10: send
public function send($data)
{
$this->create(null);
$this->set($data);
$Invoice = ClassRegistry::init('LilInvoices.Invoice');
$Vat = ClassRegistry::init('LilInvoices.Vat');
$vats = $Vat->findList();
if ($this->validates() && ($invoices = $Invoice->find('all', array('conditions' => array('Invoice.id' => $data['InvoiceEmail']['invoices']), 'contain' => array('InvoicesItem', 'InvoicesCounter', 'Client' => 'PrimaryAddress', 'InvoicesAttachment', 'InvoicesTax' => 'Vat'))))) {
// generate PDF
App::uses('LilReport', 'Lil.Lib');
App::uses('Sanitize', 'Utility');
$report = new LilReport();
$report->helpers(array('Lil.Lil', 'Lil.LilDate', 'Lil.LilFloat', 'Html'));
$report->template('', 'LilInvoices.lil_invoices_pdf');
$report->set(array('vats' => $vats));
$page = 0;
foreach ($invoices as $i) {
if ($page > 0) {
$report->addPage();
}
$report->set(array('data' => $i));
$report->render(null, array('template' => $i['InvoicesCounter']['layout']));
$page++;
}
$filename = 'invoices_' . strftime('%Y%m%d%H%M%S');
$report->output(TMP . $filename, 'F');
// init and send email
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail();
$email->template('LilInvoices.send_invoice');
$email->from(Configure::read('Lil.from.email'), Configure::read('Lil.from.name'));
$email->returnPath(Configure::read('Lil.from.email'));
$email->subject($data['InvoiceEmail']['subject']);
$email->to($data['InvoiceEmail']['to']);
if (!empty($data['InvoiceEmail']['cc']) && $data['InvoiceEmail']['cc'] != $data['InvoiceEmail']['to']) {
$email->cc($data['InvoiceEmail']['cc']);
}
Cache::write('LilInvoices.emailCacheSubject', $data['InvoiceEmail']['subject'], 'Lil');
Cache::write('LilInvoices.emailCacheBody', $data['InvoiceEmail']['body'], 'Lil');
Cache::write('LilInvoices.emailCacheCC', $data['InvoiceEmail']['cc'], 'Lil');
if (isset($data['InvoiceEmail']['cc_me'])) {
Cache::write('LilInvoices.emailCacheCCMe', $data['InvoiceEmail']['cc_me'], 'Lil');
}
Cache::write('LilInvoices.emailCacheTo', $data['InvoiceEmail']['to'], 'Lil');
$email->viewVars(array('body' => $data['InvoiceEmail']['body'], 'invoices' => $invoices));
$ats = array($filename . '.pdf' => array('file' => TMP . $filename . '.pdf', 'mimetype' => 'application/pdf'));
App::uses('Sanitize', 'Utility');
foreach ($invoices as $i) {
foreach ($i['InvoicesAttachment'] as $atch) {
$atch_name = 'at_' . $i['Invoice']['no'] . '_' . $atch['original'];
$atch_file = APP . 'uploads' . DS . 'Invoice' . DS . $atch['filename'];
if (file_exists($atch_file)) {
$ats[Sanitize::paranoid($atch_name, array('-', '_', '.'))] = array('file' => $atch_file, 'mimetype' => $atch['mimetype']);
}
}
}
$email->attachments($ats);
$result = $email->send();
unlink(TMP . $filename . '.pdf');
return $result;
}
return false;
}