本文整理汇总了PHP中CakeEmail::subject方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeEmail::subject方法的具体用法?PHP CakeEmail::subject怎么用?PHP CakeEmail::subject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CakeEmail
的用法示例。
在下文中一共展示了CakeEmail::subject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _sendPart
private function _sendPart()
{
if (empty($this->_recipients)) {
return true;
}
$json = array('to' => $this->_getAddress(array_splice($this->_recipients, 0, $this->_config['count'])), 'category' => !empty($this->_headers['X-Category']) ? $this->_headers['X-Category'] : $this->_config['category']);
//Sendgrid Substitution Tags
if (!empty($this->_headers['X-Sub'])) {
foreach ($this->_headers['X-Sub'] as $key => $value) {
$json['sub'][$key] = array_splice($value, 0, $this->_config['count']);
}
}
$params = array('api_user' => $this->_config['username'], 'api_key' => $this->_config['password'], 'x-smtpapi' => json_encode($json), 'to' => 'example3@sendgrid.com', 'subject' => $this->_cakeEmail->subject(), 'html' => $this->_cakeEmail->message('html'), 'text' => $this->_cakeEmail->message('text'), 'from' => $this->_config['from'], 'fromname' => $this->_config['fromName'], 'replyto' => array_keys($this->_replyTo)[0]);
$attachments = $this->_cakeEmail->attachments();
if (!empty($attachments)) {
foreach ($attachments as $key => $value) {
$params['files[' . $key . ']'] = '@' . $value['file'];
}
}
$result = json_decode($this->_exec($params));
if ($result->message != 'success') {
return $result;
} else {
return $this->_sendPart();
}
}
示例2: send
/**
* Sends out email via Mandrill
*
* @param CakeEmail $email
* @return array
*/
public function send(CakeEmail $email)
{
// CakeEmail
$this->_cakeEmail = $email;
$from = $this->_cakeEmail->from();
list($fromEmail) = array_keys($from);
$fromName = $from[$fromEmail];
$this->_config = $this->_cakeEmail->config();
$this->_headers = $this->_cakeEmail->getHeaders();
$message = array('html' => $this->_cakeEmail->message('html'), 'text' => $this->_cakeEmail->message('text'), 'subject' => mb_decode_mimeheader($this->_cakeEmail->subject()), 'from_email' => $fromEmail, 'from_name' => $fromName, 'to' => array(), 'headers' => array('Reply-To' => $fromEmail), 'important' => false, 'track_opens' => null, 'track_clicks' => null, 'auto_text' => null, 'auto_html' => null, 'inline_css' => null, 'url_strip_qs' => null, 'preserve_recipients' => null, 'view_content_link' => null, 'tracking_domain' => null, 'signing_domain' => null, 'return_path_domain' => null, 'merge' => true, 'tags' => null, 'subaccount' => null);
$message = array_merge($message, $this->_headers);
foreach ($this->_cakeEmail->to() as $email => $name) {
$message['to'][] = array('email' => $email, 'name' => $name, 'type' => 'to');
}
foreach ($this->_cakeEmail->cc() as $email => $name) {
$message['to'][] = array('email' => $email, 'name' => $name, 'type' => 'cc');
}
foreach ($this->_cakeEmail->bcc() as $email => $name) {
$message['to'][] = array('email' => $email, 'name' => $name, 'type' => 'bcc');
}
$attachments = $this->_cakeEmail->attachments();
if (!empty($attachments)) {
$message['attachments'] = array();
foreach ($attachments as $file => $data) {
$message['attachments'][] = array('type' => $data['mimetype'], 'name' => $file, 'content' => base64_encode(file_get_contents($data['file'])));
}
}
$params = array('message' => $message, "async" => false, "ip_pool" => null, "send_at" => null);
return $this->_exec($params);
}
示例3: handleException
public function handleException(Exception $exception, $shutdown = false)
{
$this->_exception = $exception;
$email = new CakeEmail('error');
$prefix = Configure::read('ExceptionNotifier.prefix');
$from = $email->from();
if (empty($from)) {
$email->from('exception.notifier@default.com', 'Exception Notifier');
}
$subject = $email->subject();
if (empty($subject)) {
$email->subject($prefix . '[' . date('Ymd H:i:s') . '][' . $this->_getSeverityAsString() . '][' . ExceptionText::getUrl() . '] ' . $exception->getMessage());
}
if ($this->useSmtp) {
$email->transport('Smtp');
$email->config($this->smtpParams);
}
$text = ExceptionText::getText($exception->getMessage(), $exception->getFile(), $exception->getLine());
$email->send($text);
// return Exception.handler
if ($shutdown || !$this->_exception instanceof ErrorException) {
$config = Configure::read('Exception');
$handler = $config['handler'];
if (is_string($handler)) {
call_user_func($handler, $exception);
} elseif (is_array($handler)) {
call_user_func_array($handler, $exception);
}
}
}
示例4: sendResetMail
/**
* sendResetMail
*
*/
public static function sendResetMail($data, $user)
{
$modelName = $data['model'];
$loader = ReminderConfigLoader::init($modelName);
$email = new CakeEmail('reminder');
$from = $email->from();
if (empty($from)) {
$email->from('reminder@example.com', 'Reminder');
}
$subject = $loader->load('subject');
if (empty($subject)) {
$subject = $email->subject();
}
if (empty($subject)) {
$subject = 'Reminder';
// default
}
$email->subject($subject);
$email->to($data['email']);
$template = $loader->load('view.reset_mail');
if (empty($template)) {
$template = 'reset_mail';
}
$email->template('Reminder.' . $template);
$email->viewVars(array('data' => $data, 'user' => $user));
return $email->send();
}
示例5: send
/**
* Sends out email via SparkPost
*
* @param CakeEmail $email
* @return array
*/
public function send(CakeEmail $email)
{
// CakeEmail
$this->_cakeEmail = $email;
$this->_config = $this->_cakeEmail->config();
$this->_headers = $this->_cakeEmail->getHeaders();
// Not allowed by SparkPost
unset($this->_headers['Content-Type']);
unset($this->_headers['Content-Transfer-Encoding']);
unset($this->_headers['MIME-Version']);
unset($this->_headers['X-Mailer']);
$from = $this->_cakeEmail->from();
list($fromEmail) = array_keys($from);
$fromName = $from[$fromEmail];
$message = ['html' => $this->_cakeEmail->message('html'), 'text' => $this->_cakeEmail->message('text'), 'from' => ['name' => $fromName, 'email' => $fromEmail], 'subject' => mb_decode_mimeheader($this->_cakeEmail->subject()), 'recipients' => [], 'transactional' => true];
foreach ($this->_cakeEmail->to() as $email => $name) {
$message['recipients'][] = ['address' => ['email' => $email, 'name' => $name], 'tags' => $this->_headers['tags']];
}
foreach ($this->_cakeEmail->cc() as $email => $name) {
$message['recipients'][] = ['address' => ['email' => $email, 'name' => $name], 'tags' => $this->_headers['tags']];
}
foreach ($this->_cakeEmail->bcc() as $email => $name) {
$message['recipients'][] = ['address' => ['email' => $email, 'name' => $name], 'tags' => $this->_headers['tags']];
}
unset($this->_headers['tags']);
$attachments = $this->_cakeEmail->attachments();
if (!empty($attachments)) {
$message['attachments'] = array();
foreach ($attachments as $file => $data) {
if (!empty($data['contentId'])) {
$message['inlineImages'][] = array('type' => $data['mimetype'], 'name' => $data['contentId'], 'data' => base64_encode(file_get_contents($data['file'])));
} else {
$message['attachments'][] = array('type' => $data['mimetype'], 'name' => $file, 'data' => base64_encode(file_get_contents($data['file'])));
}
}
}
$message = array_merge($message, $this->_headers);
// Load SparkPost configuration settings
$config = ['key' => $this->_config['sparkpost']['api_key']];
if (isset($this->_config['sparkpost']['timeout'])) {
$config['timeout'] = $this->_config['sparkpost']['timeout'];
}
// Set up HTTP request adapter
$httpAdapter = new Ivory\HttpAdapter\Guzzle6HttpAdapter($this->__getClient());
// Create SparkPost API accessor
$sparkpost = new SparkPost\SparkPost($httpAdapter, $config);
// Send message
try {
return $sparkpost->transmission->send($message);
} catch (SparkPost\APIResponseException $e) {
// TODO: Determine if BRE is the best exception type
throw new BadRequestException(sprintf('SparkPost API error %d (%d): %s (%s)', $e->getAPICode(), $e->getCode(), ucfirst($e->getAPIMessage()), $e->getAPIDescription()));
}
}
示例6: testPostmarkSend
/**
* testSendgridSend method
*
* @return void
*/
public function testPostmarkSend()
{
$this->email->template('default', 'default');
$this->email->emailFormat('both');
$this->email->to(array('test1@example.com' => 'Recipient'));
$this->email->subject('Test email via SedGrid');
$this->email->addHeaders(array('X-Tag' => 'my tag'));
$sendReturn = $this->email->send();
// $headers = $this->email->getHeaders(array('to'));
// $this->assertEqual($sendReturn['To'], $headers['To']);
// $this->assertEqual($sendReturn['ErrorCode'], 0);
// $this->assertEqual($sendReturn['Message'], 'OK');
}
示例7: index
public function index()
{
//checking session
$uid = $this->Session->read('Auth.User.id');
if (isset($uid)) {
return $this->redirect(array('controller' => 'profiles', 'action' => 'edit'));
}
$this->layout = 'main';
$title = 'User Registration';
$this->set(compact('title'));
//check from submit or not
if ($this->request->is('post')) {
//uploading image file
$new_file_name = rand(1000, rand(100000, rand(1000000, 10000000))) . "_" . md5(time()) . "_" . time() . $this->data['Profile']['image']['name'];
move_uploaded_file($this->data['Profile']['image']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . '/registration/app/webroot/img/image/' . $new_file_name);
$this->request->data['Profile']['image'] = '/registration/app/webroot/img/image/' . $new_file_name;
//----------------------
//save data
if ($this->Profile->save($this->request->data)) {
$Email = new CakeEmail();
$Email->from(array('me@example.com' => 'Cake registration demo'));
$Email->to($this->data['Profile']['email']);
$Email->subject('Registration process completed successfully');
$Email->send('Welcome to cake registration demo .Your registration process completed successfully');
$this->Session->setFlash('User details has been saved.', 'default', array('class' => 'alert alert-success'));
return $this->redirect(array('action' => 'login'));
}
//------------
//on failure
$this->Session->setFlash('Unable to add User details.', 'default', array('class' => 'alert alert-danger'));
}
}
示例8: sendEmail
public function sendEmail($to = NULL, $subject = NULL, $data = NULL, $template = NULL, $format = 'text', $cc = NULL, $bcc = NULL)
{
$Email = new CakeEmail();
$Email->from(array(Configure::read('Email_From_Email') => Configure::read('Email_From_Name')));
//$Email->config(Configure::read('TRANSPORT'));
$Email->config('default');
$Email->template($template);
if ($to != NULL) {
$Email->to($to);
}
if ($cc != NULL) {
$Email->cc($cc);
}
if ($bcc != NULL) {
$Email->bcc($bcc);
}
$Email->subject($subject);
$Email->viewVars($data);
$Email->emailFormat($format);
if ($Email->send()) {
return true;
} else {
return false;
}
}
示例9: add
/**
* add method
*
* @return void
*/
public function add()
{
$institucions = $this->User->Institucion->find('list');
if ($this->request->is('post')) {
// Password
$password = $this->strongPassword($this->request->data['User']['username']);
$this->request->data['User']['password'] = $password;
$this->request->data['User']['role'] = 'administrador';
$this->request->data['User']['active'] = true;
$this->User->create();
if ($this->User->save($this->request->data)) {
// Envio de clave al usuario
$email = new CakeEmail('default');
$email->template('administrador');
$email->emailFormat('text');
$email->from('mail@institucion.gob.sv');
$email->to($this->request->data['User']['username']);
$email->subject('Cuenta gobscore.');
$email->viewVars(array('name' => $this->request->data['User']['name'], 'institucion' => $institucions[$this->request->data['User']['institucion_id']], 'username' => $this->request->data['User']['username'], 'password' => $password));
if ($email->send()) {
$mensaje = 'Los datos de la institución y cuenta de ' . 'administrador han sido enviados correctamente';
}
$this->Session->setFlash($mensaje);
return $this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('La información ha no sido almacenada. Por favor, trate de nuevo.'));
}
}
$this->set(compact('institucions'));
}
示例10: contact
public function contact()
{
$this->loadModel('Contact');
if ($this->request->is('post')) {
$this->Contact->set($this->request->data);
if ($this->Contact->validates()) {
App::uses('CakeEmail', 'Network/Email');
if ($this->request->data['Contact']['subject'] == '') {
$this->request->data['Contact']['subject'] = 'Contact';
}
$Email = new CakeEmail('smtp');
$Email->viewVars(array('mailData' => $this->request->data));
$Email->template('contact', 'default');
$Email->emailFormat('html');
$Email->from(array($this->request->data['Contact']['mail'] => $this->request->data['Contact']['name']));
$Email->to('contact@youthbook.be');
$Email->subject($this->request->data['Contact']['subject']);
$Email->attachments(array('logo.png' => array('file' => WWW_ROOT . '/img/icons/logo.png', 'mimetype' => 'image/png', 'contentId' => 'logo')));
$Email->send();
$this->Flash->success(__('Votre mail a bien été envoyé.'));
return $this->redirect($this->referer());
} else {
$this->Session->write('errors.Contact', $this->Contact->validationErrors);
$this->Session->write('data', $this->request->data);
$this->Session->write('flash', 'Le mail n’a pas pu être envoyé. Veuillez réessayer SVP.');
return $this->redirect($this->referer());
}
}
}
示例11: CakeEmail
function email_referrer($receiver = null, $invite_total = null, $code = null)
{
$share_link = FULL_BASE_URL . '/invite/' . $code;
//For our coming soon incentive, we were increasing peoples call rates by 10 cents for every person that joined the site from their link
//so the funciton below simply calculates their new rate.
//add in your own function if you want
$total_referrals = $invite_total;
$current_rate = 2.5 + $invite_total * 0.1;
if ($current_rate > 3.5) {
$current_rate = 3.5;
}
$message = 'Nice work!
<br /><br />
One of your friends just joined Amplifyd. Your new caller rate is now $' . $current_rate . '0/per call.
<br /><br />
Because of you, our public voice just got stronger and louder.
<br /><br />
Keep it up, here\'s your unique invite link again:
<br />
<a href="' . $share_link . '" >' . $share_link . '</a>
<br /><br />
';
$email = new CakeEmail('sendgrid');
$email->emailFormat('html');
$email->to($receiver);
$email->subject('A Friend Just Joined');
$email->send($message);
}
开发者ID:suspended,项目名称:CakePHP-Coming-Soon-Website-With-Referral-Rewards,代码行数:28,代码来源:SignupsController.php
示例12: index
public function index()
{
if (!empty($this->data)) {
if ($this->request->is('post')) {
$data = $this->request->data;
if ($this->Matriculation->save($data)) {
$email = new CakeEmail();
$email->config('default');
$email->from(array('contato@sardonixidiomas.com' => 'Sardonix Idiomas | Automático'));
$email->to('contato@sardonixidiomas.com');
$email->subject("Matrícula - {$data['Matriculation']['name']} ");
$cursos = '';
if (isset($data['Matriculation']['english'])) {
$cursos .= 'Inglês; ';
}
if (isset($data['Matriculation']['italian'])) {
$cursos .= 'Italiano; ';
}
if (isset($data['Matriculation']['portuguese'])) {
$cursos .= 'Português; ';
}
$date = new DateTime();
$message = "Nome: {$data['Matriculation']['name']}\n\n";
$message .= "Telefone: {$data['Matriculation']['phone']}\n\n";
$message .= "Celular: {$data['Matriculation']['cellphone']}\n\n";
$message .= "Idiomas de interesse: {$cursos}\n\n";
$message .= "E-mail: {$data['Matriculation']['email']} \n\n";
$message .= "Soube: {$data['Matriculation']['where']}\n\n";
$message .= "Acessou em: " . $date->format('d/m/Y H:i:s');
$email->send($message);
$this->render('enviado');
}
}
}
}
示例13: send_mail
/**
* Send comfirmation email whit unique code
*/
public function send_mail()
{
$user = $this->Session->read('Auth');
if (isset($user)) {
if ($user['User']['active'] == 0) {
$uniqueId = uniqid("", TRUE);
if ($this->saveSendComfirmation($user, $uniqueId)) {
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail('gmail');
$link = "http://" . $_SERVER['HTTP_HOST'] . $this->webroot . "email/activate_account/" . $user['User']['id'] . '-' . $uniqueId;
$email->from('stagesstatcoordonateur@gmail.com');
$email->to($user['User']['email']);
$email->subject('Mail Confirmation');
$email->emailFormat('html');
$email->template('signup');
$email->viewVars(array('username' => $user['User']['full_name'], 'link' => $link));
$this->Session->setFlash(__('Email comfirmation has been sent'), 'flash/success');
$email->send();
} else {
$this->Session->setFlash(__('Could not send email.'), 'flash/error');
}
} else {
$this->Session->setFlash(__('Your email is already comfirmed.'), 'flash/error');
}
} else {
$this->Session->setFlash(__('You are not login.'), 'flash/error');
}
$this->redirect('/');
}
示例14: main
public function main()
{
// =============================================================================================
// 各種情報を取得
// =============================================================================================
// 今年分の振込情報を取得
$year = date('Y');
$transfer_histories = $this->TTransferHistory->findTransferHistory($year);
// 振込目標額を取得
$total_price = $this->MParameter->find('first', array('conditions' => array('parameter_name' => 'total_price'), 'fields' => array('parameter_value')));
$total_price = $total_price['MParameter']['parameter_value'];
// 合計振込額を取得
$total_transfer_price = $this->TTransferHistory->find('first', array('conditions' => array('deleted' => 1), 'fields' => array('sum(transfer_price) as total_transfer_price')));
$total_transfer_price = $total_transfer_price[0]['total_transfer_price'];
// 振込残高を取得
$remaining_price = $total_price - $total_transfer_price;
// =============================================================================================
// メール送信処理
// =============================================================================================
$email = new CakeEmail('admin');
$email->to('1970emerson.lake.and.palmer@gmail.com');
$email->subject($year . '年の振込情報');
$email->emailFormat('text');
$email->template('transfer_report');
$email->viewVars(array('total_price' => number_format($total_price), 'total_transfer_price' => number_format($total_transfer_price), 'remaining_price' => number_format($remaining_price), 'year' => $year, 'transfer_histories' => $transfer_histories));
$email->send();
}
示例15: register
public function register()
{
if ($this->request->is('post')) {
if ($this->data['User']['password'] == $this->data['User']['password_confirm']) {
$this->request->data['User']['role'] = 'student';
$this->User->create();
if ($this->User->save($this->request->data)) {
App::uses('CakeEmail', 'Network/Email');
$user = $this->User->read(null, $this->User->id);
$link = array('controller' => 'users', 'action' => 'activate', $this->User->id . '-' . md5($user['User']['password']));
$mail = new CakeEmail('gmail');
$mail->from("test.cour.php@gmail.com");
$mail->to($this->request->data['User']['email']);
$mail->subject(__('Please confirm your email !'));
$mail->emailFormat('html');
$mail->template('signup');
$mail->viewVars(array('username' => $this->request->data['User']['username'], 'link' => $link));
$mail->send();
$this->redirect(array('action' => 'login'));
}
} else {
$this->Flash->error(__('The passwords do not match.'));
}
}
}