本文整理汇总了PHP中CakeEmail::emailFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeEmail::emailFormat方法的具体用法?PHP CakeEmail::emailFormat怎么用?PHP CakeEmail::emailFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CakeEmail
的用法示例。
在下文中一共展示了CakeEmail::emailFormat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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');
}
示例2: _sendEmail
protected function _sendEmail()
{
App::uses('CakeEmail', 'Network/Email');
$Email = new CakeEmail();
$Email->emailFormat('text')->template('new_user', 'default')->from(Configure::read('Site.email_from'))->replyTo($this->request->data['Contact']['email'])->subject('EU-GENIE Contact Form')->to(Configure::read('Site.email_to'));
$Email->send();
}
示例3: 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();
}
示例4: __resetPassword
protected function __resetPassword($username = '')
{
$this->loadModel('User');
$conditions = array('username' => $username);
$options = array('conditions' => $conditions);
$user = $this->User->find('first', $options);
$message = 'El usuario no existe.';
if ($user) {
$data['password'] = $this->strongPassword($username);
$this->User->id = $user['User']['id'];
$mensaje = 'No ha sido posible cambiar el password, intente de nuevo.';
if ($this->User->save($data)) {
$email = new CakeEmail('default');
$email->template('change_password');
$email->emailFormat('text');
$email->from('mail@institucion.gob.sv');
$email->to($username);
$email->subject('Reinicio de credenciales gobscore.');
$email->viewVars(array('username' => $username, 'password' => $data['password']));
$message = 'El password ha sido cambiado con éxito. Ha ocurrido un ' . 'error en el envío de su nuevo password.';
if ($email->send()) {
$message = 'Los datos de la institución y cuenta de ' . 'administrador han sido enviados correctamente';
}
}
}
return $message;
}
示例5: saveLead
/**
* Saves a lead into the leads table
* @param array $data
* @param string $type The lead type - usually the page type
* @return boolean
*/
public function saveLead($data = array(), $type = null)
{
if (!$data || !$type) {
throw new NotFoundException(__('Invalid data or type'));
}
$data['Lead']['type'] = $type;
$this->create();
$result = $this->save($data);
if (!$result) {
throw new LogicException(__('There was a problem, please review the errors below and try again.'));
}
$this->Setting = ClassRegistry::init('Setting');
$siteEmail = $this->Setting->get('siteEmail');
$siteName = $this->Setting->get('siteName');
$ccEmails = $this->Setting->get('siteEmailsCc');
if ($siteEmail) {
App::uses('CakeEmail', 'Network/Email');
$email = new CakeEmail();
$email->from(array($result['Lead']['email'] => $result['Lead']['name']));
$email->to($siteEmail);
if ($ccEmails) {
$email->cc($ccEmails);
}
$email->subject(__('%s - The %s form has been submitted', $siteName, $result['Lead']['type']));
$email->template('newLead');
$email->emailFormat('both');
$email->viewVars(array('lead' => $result, 'siteName' => $siteName));
$email->send();
}
return true;
}
示例6: main
public function main()
{
define('TIMEZONE', 'Asia/Bangkok');
date_default_timezone_set(TIMEZONE);
$now = date("Y-m-d H:i:s");
$tomorrow = date("Y-m-d H:i:s", time() + EVENT_REMIDER_TIMER);
$optionCalendar = array('order' => array('from_date' => 'asc'), 'conditions' => array('from_date >=' => $now, 'to_date <=' => $tomorrow));
$events = $this->Calendar->find("all", $optionCalendar);
foreach ($events as $key => $event) {
$content = array();
$content["id"] = $event["Calendar"]["id"];
$content["name"] = $event["Calendar"]["name"];
$content["description"] = $event["Calendar"]["description"];
$content["from_date"] = $this->_formatDate($events[$key]["Calendar"]["from_date"], "d-m-Y H:i");
$content["to_date"] = $this->_formatDate($events[$key]["Calendar"]["to_date"], "d-m-Y H:i");
$id = $event["Calendar"]["id"];
$user = $this->UserModel->findById($event["Calendar"]["user_id"]);
$content["receive_name"] = $user["UserModel"]["display_name"];
$Email = new CakeEmail('noreply');
$noreplyConf = $Email->config();
$Email->template('calendar_remider');
$Email->emailFormat('html');
$Email->viewVars(array('emailContent' => $content));
$Email->from($noreplyConf['from']);
$Email->to($user["UserModel"]["user_email"]);
$Email->subject(__('Calendar Reminder'));
$Email->send();
}
//echo EVENT_REMIDER_TIMER;
}
示例7: index
/**
* index method
*
* @return void
*/
public function index()
{
$this->Comment->recursive = 0;
if (!empty($this->request->data)) {
$this->Comment->create($this->request->data);
if ($this->Comment->validates()) {
if (!empty($this->request->data['Comment']['website'])) {
$this->Session->setFlash(__("Your Mail us is reached."), 'notif', array('class' => "success", 'type' => 'ok-sign'));
$this->request->data = array();
} else {
$token = md5(time() . ' - ' . uniqid());
$this->Comment->create(array('name' => $this->request->data['Comment']['name'], 'mail' => $this->request->data['Comment']['mail'], 'content' => $this->request->data['Comment']['content'], 'token' => $token));
$this->Comment->save();
App::uses('CakeEmail', 'Network/Email');
$CakeEmail = new CakeEmail('smtp');
// à changer par Default sur le site en ligne sinon smtp
$CakeEmail->to(array('philippewagner2@sfr.fr'));
$CakeEmail->from(array($this->request->data['Comment']["mail"] => "livre d or"));
$CakeEmail->subject(__("Commentaire sur le livre d'or"));
$CakeEmail->viewVars($this->request->data['Comment'] + array("name" => $this->Comment->name, "mail" => $this->Comment->mail, "content" => $this->Comment->content, 'token' => $token, 'id' => $this->Comment->id));
$CakeEmail->emailFormat('html');
$CakeEmail->template('commentaire');
$CakeEmail->send();
$this->Session->setFlash(__('The comment has been saved.'), 'notif', array('class' => "success", 'type' => 'ok-sign'));
return $this->redirect(array('action' => 'index'));
}
} else {
$this->Session->setFlash(__('The comment could not be saved. Please, try again.'), 'notif', array('class' => "danger", 'type' => 'info-sign'));
}
}
$this->paginate = array('Comment' => array('limit' => 3, 'order' => array('Comment.created' => 'desc')));
$d['comments'] = $this->Paginate('Comment', array('Comment.online >= 1'));
$this->set($d);
}
示例8: individualMail
public function individualMail($section, $arr = array())
{
$this->autoRender = false;
$contents = $this->Mail->findBySection($section);
$content = $contents['Mail']['content'];
foreach ($arr as $key => $val) {
$content = str_replace("~~{$key}~~", $val, $content);
}
if (!empty($arr['TO_EMAIL']) && Validation::email($arr['TO_EMAIL'], true)) {
$email = new CakeEmail();
$email->template('default');
$email->config('default');
$email->emailFormat('html')->to($arr['TO_EMAIL'])->subject($contents['Mail']['subject']);
try {
if ($email->send($content)) {
return;
} else {
return;
}
} catch (Exception $e) {
return;
}
}
return;
}
示例9: _prepareData
/**
* Prepares the data array.
* Adds headers and content
*
* @return void
*/
protected function _prepareData()
{
$this->_data = array();
if (count($this->_cakeEmail->cc()) > 0) {
throw new CakeException('Postageapp transport does not support cc');
}
if (count($this->_cakeEmail->bcc()) > 0) {
throw new CakeException('Postageapp transport does not support bcc');
}
if (count($this->_cakeEmail->sender()) > 0) {
throw new CakeException('Postageapp transport does not support sender');
}
$headers = $this->_cakeEmail->getHeaders(array('from', 'sender', 'replyTo', 'returnPath', 'to', 'subject'));
$this->_data['recipients'] = $headers['To'];
$map = array('From', 'Subject', 'Reply-To', 'X-Mailer', 'MIME-Version', 'Content-Transfer-Encoding');
foreach ($map as $header) {
if (!empty($headers[$header])) {
$this->_addHeader($header, $headers[$header]);
}
}
$emailFormat = $this->_cakeEmail->emailFormat();
if ($emailFormat == 'both' || $emailFormat == 'text') {
$this->_data['content']['text/plain'] = $this->_cakeEmail->message('text');
}
if ($emailFormat == 'both' || $emailFormat == 'html') {
$this->_data['content']['text/html'] = $this->_cakeEmail->message('html');
}
}
示例10: 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'));
}
示例11: forgot
/**
* permet de refaire un mot de passe oublié
* @return [type] [description]
**/
public function forgot()
{
$this->layout = "home";
if (!empty($this->request->data)) {
$user = $this->User->findByMail($this->request->data['User']['mail'], array('id'));
if (empty($user)) {
$this->Session->setFlash(__("This email address is not associated with any account"), 'notif', array('class' => "danger", 'type' => 'info'));
} else {
$token = md5(uniqid() . time());
$this->User->id = $user['User']['id'];
$this->User->saveField('token', $token);
App::uses('CakeEmail', 'Network/Email');
$cakeMail = new CakeEmail('smtp');
// à changer par default sur le site en ligne ou smtp en local
$cakeMail->to($this->request->data['User']['mail']);
$cakeMail->from(array('philippewagner2@sfr.fr' => "site "));
$cakeMail->subject(__('Password regeneration'));
$cakeMail->template('forgot');
$cakeMail->viewVars(array('token' => $token, 'id' => $user['User']['id']));
$cakeMail->emailFormat('text');
$cakeMail->send();
$this->Session->setFlash(__("An email was sent to you with instructions to regenerate your password! Please check your span !!"), "notif", array('class' => 'info', 'type' => 'info'));
}
}
}
示例12: index
/**
* Wenn es sich um einen POST-Request handelt, wird eine Rundmail mit den übergebenen Daten versendet.
*
* @author aloeser
* @return void
*/
public function index()
{
if ($this->request->is('POST')) {
$conditions = array('User.mail !=' => '', 'User.admin != ' => 2);
if (!$this->request->data['Mail']['sendToAll']) {
$conditions['User.leave_date'] = null;
}
$activeUsersWithEmail = $this->User->find('all', array('conditions' => $conditions));
$receivers = array();
foreach ($activeUsersWithEmail as $user) {
array_push($receivers, $user['User']['mail']);
}
$senderMail = 'humboldt-cafeteria@versanet.de';
$senderName = 'Humboldt Cafeteria';
$EMail = new CakeEmail();
$EMail->from(array($senderMail => $senderName));
$EMail->bcc($receivers);
$EMail->subject($this->request->data['Mail']['subject']);
$EMail->config('web');
$EMail->template('default');
$EMail->emailFormat('html');
$EMail->viewVars(array('senderName' => $senderName, 'senderMail' => $senderMail, 'content' => $this->request->data['Mail']['content'], 'subject' => $this->request->data['Mail']['subject'], 'allowReply' => $this->request->data['Mail']['allowReply']));
if ($EMail->send()) {
$this->Session->setFlash('Die Rundmail wurde erfolgreich abgeschickt.', 'alert-box', array('class' => 'alert-success'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash('Beim Senden ist ein Fehler aufgetreten.', 'alert-box', array('class' => 'alert-error'));
}
}
$this->set('actions', array());
}
示例13: 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());
}
}
}
示例14: 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;
}
}
示例15: 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