当前位置: 首页>>代码示例>>PHP>>正文


PHP CakeEmail::deliver方法代码示例

本文整理汇总了PHP中CakeEmail::deliver方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeEmail::deliver方法的具体用法?PHP CakeEmail::deliver怎么用?PHP CakeEmail::deliver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CakeEmail的用法示例。


在下文中一共展示了CakeEmail::deliver方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: write

 public function write($type, $message)
 {
     extract($this->config);
     if (empty($levels) || in_array($type, $levels)) {
         if ($duplicates || !$duplicates && strpos(file_get_contents($file), $message) === false) {
             try {
                 CakeEmail::deliver(null, 'An error has occurred: ' . $type, $message, $email);
                 if (!$duplicates) {
                     $output = $message . "\n";
                     file_put_contents($file, $output, FILE_APPEND);
                 }
             } catch (Exception $e) {
             }
         }
     }
 }
开发者ID:rikdc,项目名称:Logger,代码行数:16,代码来源:EmailLogger.php

示例2: testDeliver

/**
 * testDeliver method
 *
 * @return void
 */
	public function testDeliver() {
		$instance = CakeEmail::deliver('all@cakephp.org', 'About', 'Everything ok', array('from' => 'root@cakephp.org'), false);
		$this->assertInstanceOf('CakeEmail', $instance);
		$this->assertSame($instance->to(), array('all@cakephp.org' => 'all@cakephp.org'));
		$this->assertSame($instance->subject(), 'About');
		$this->assertSame($instance->from(), array('root@cakephp.org' => 'root@cakephp.org'));

		$config = array(
			'from' => 'cake@cakephp.org',
			'to' => 'debug@cakephp.org',
			'subject' => 'Update ok',
			'template' => 'custom',
			'layout' => 'custom_layout',
			'viewVars' => array('value' => 123),
			'cc' => array('cake@cakephp.org' => 'Myself')
		);
		$instance = CakeEmail::deliver(null, null, array('name' => 'CakePHP'), $config, false);
		$this->assertSame($instance->from(), array('cake@cakephp.org' => 'cake@cakephp.org'));
		$this->assertSame($instance->to(), array('debug@cakephp.org' => 'debug@cakephp.org'));
		$this->assertSame($instance->subject(), 'Update ok');
		$this->assertSame($instance->template(), array('template' => 'custom', 'layout' => 'custom_layout'));
		$this->assertSame($instance->viewVars(), array('value' => 123, 'name' => 'CakePHP'));
		$this->assertSame($instance->cc(), array('cake@cakephp.org' => 'Myself'));

		$configs = array('from' => 'root@cakephp.org', 'message' => 'Message from configs', 'transport' => 'Debug');
		$instance = CakeEmail::deliver('all@cakephp.org', 'About', null, $configs, true);
		$message = $instance->message();
		$this->assertEquals($configs['message'], $message[0]);
	}
开发者ID:rsuarez2012,项目名称:bioasistmr,代码行数:34,代码来源:CakeEmailTest.php

示例3: forgotpassword

 public function forgotpassword()
 {
     if ($this->request->is('post')) {
         $this->loadModel('User');
         $mail = $this->request->data['UserForgotPassword']['frkUserEmail'];
         $data = $this->User->find('first', array('conditions' => array('frkUserEmail' => $mail), 'fields' => array('frkUserEmail', 'frkUserID')));
         if (!$data) {
             $msg = 'No Such E-mail address registerd with us';
             $this->Session->setFlash(__($msg));
             return $this->redirect(array('action' => 'forgotpassword'));
         } else {
             $key = $this->randStrGen(20);
             $sql = "UPDATE `users` SET `frkPasswordReset` =  '" . $key . "'  WHERE `users`.`frkUserID` = " . $data['User']['frkUserID'] . " ";
             $this->User->query($sql);
             $id = $data['User']['frkUserID'];
             $to = $data['User']['frkUserEmail'];
             $baseurl = Router::url('/', true);
             $link = $baseurl . "pages/reset/" . $key . "/" . $id;
             $subject = 'Reset password';
             $message1 = "Hello " . $to . "";
             $message2 = "\n Someone has requested a link to change your password. You can do this through the link below.";
             $message3 = "\n <a href='" . $link . "'></a>";
             $message4 = "\n If you didn't request this, please ignore this email.";
             $message5 = "\n Your password won't change until you access the link above and create a new one.";
             $message = $message1 . $message2 . $message3 . $message4 . $message5;
             $headers = 'From: info@farookadmission.in' . "\r\n" . 'Reply-To: info@farookadmission.in' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
             CakeEmail::deliver($to, $subject, $message, array('transport' => 'Smtp', 'from' => array('admission@farookcollege.ac.in' => 'Farook College PG Admission'), 'host' => 'email-smtp.us-west-2.amazonaws.com', 'tls' => true, 'port' => 587, 'timeout' => 30, 'username' => 'AKIAJJ62UMBPAOB3AAQA', 'password' => 'Ar12GanG4JddabSgQOQrQk0KFetnHANF5dwFx2vs/GmX', 'client' => null, 'log' => false));
             //$action = mail($to, $subject, $message, $headers);
             /*                 * ************* */
             $msg = 'Please check your email for reset instructions';
             $this->Session->setFlash(__($msg));
             /*if ($action) {
             
                                 
                             } else {
                                 $msg = 'Something went wrong with activation mail. Please try later';
             
                                 $this->Session->setFlash(__($msg));
                             }*/
         }
         $this->redirect('/');
     }
 }
开发者ID:jeenamadhavan,项目名称:mespg,代码行数:43,代码来源:PagesController.php

示例4: _sendVerificationEmail

/**
 * Sends the verification email
 *
 * This method is protected and not private so that classes that inherit this
 * controller can override this method to change the varification mail sending
 * in any possible way.
 *
 * @param string $to Receiver email address
 * @param array $options EmailComponent options
 * @return boolean Success
 */
	protected function _sendVerificationEmail($to = null, $options = array()) {
		$defaults = array(
			'from' => 'noreply@' . env('HTTP_HOST'),
			'subject' => __d('users', 'Account verification'),
			'template' => 'Users.account_verification');
		$options['from'] = 'noreply@tubones.com';

		$options = array_merge($defaults, $options);

		$email = new CakeEmail();
		$email->to = $to;
		$email->from($options['from']);
		$email->subject($options['subject']);
		$email->template($options['template']);

		return $email->deliver($to, $options['subject'], $options['template'], array('from' => $options['from']));
	}
开发者ID:neterslandreau,项目名称:tubones,代码行数:28,代码来源:AppUsersController.php

示例5: testDeliver

 /**
  * testDeliver method
  *
  * @return void
  */
 public function testDeliver()
 {
     $instance = CakeEmail::deliver('all@cakephp.org', 'About', 'Everything ok', array('from' => 'root@cakephp.org'), false);
     $this->assertIsA($instance, 'CakeEmail');
     $this->assertIdentical($instance->to(), array('all@cakephp.org' => 'all@cakephp.org'));
     $this->assertIdentical($instance->subject(), 'About');
     $this->assertIdentical($instance->from(), array('root@cakephp.org' => 'root@cakephp.org'));
     $config = array('from' => 'cake@cakephp.org', 'to' => 'debug@cakephp.org', 'subject' => 'Update ok', 'template' => 'custom', 'layout' => 'custom_layout', 'viewVars' => array('value' => 123), 'cc' => array('cake@cakephp.org' => 'Myself'));
     $instance = CakeEmail::deliver(null, null, array('name' => 'CakePHP'), $config, false);
     $this->assertIdentical($instance->from(), array('cake@cakephp.org' => 'cake@cakephp.org'));
     $this->assertIdentical($instance->to(), array('debug@cakephp.org' => 'debug@cakephp.org'));
     $this->assertIdentical($instance->subject(), 'Update ok');
     $this->assertIdentical($instance->template(), array('template' => 'custom', 'layout' => 'custom_layout'));
     $this->assertIdentical($instance->viewVars(), array('value' => 123, 'name' => 'CakePHP'));
     $this->assertIdentical($instance->cc(), array('cake@cakephp.org' => 'Myself'));
 }
开发者ID:Nervie,项目名称:Beta,代码行数:21,代码来源:CakeEmailTest.php


注:本文中的CakeEmail::deliver方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。