hi Santhos,
follow below process
UsersController: in add method
You have to copy past same as..
Step 1:
/**
* add method
*
* @return void
*/
public function add() {
if ($this->request->is('post')) {
$this->User->create();
if ($this->User->save($this->request->data)) {
$this->__sendEmailConfirm($this->User->id); --> U have to add this line.
$this->Session->setFlash(__('The user has been saved'));
$this->redirect(array('action' => 'index'));
} else {
$this->Session->setFlash(__('The user could not be saved. Please, try again.'));
}
}
}
public function __sendEmailConfirm($user_id)
{
App::uses('CakeEmail', 'Network/Email');
$user = $this->User->find('first',array('conditions'=>array('User.id' => $user_id),'fields'=>array('User.id','User.email','User.username'),'recursive'=>0));
if ($user === false)
{
debug(__METHOD__." failed to retrieve User data for user.id: {$user_id}");
return false;
}
$name = $user['User']['username'];
$emailname = $user['User']['email'];
$email = new CakeEmail();
$email->from(array('noreply@'.env('SERVER_NAME') => 'MY Site'));
$email->to($user['User']['email']);
$email->subject(env('SERVER_NAME') . ' Please confirm your email address');
$email->template('user_confirm');
$email->viewVars(array('username' => $name,'emailname' =>$emailname));
$email->emailFormat('html');
return $email->send();
}
Step 2:
view/users/user_confirm.ctp:
Put below code in user_confirm.ctp
<div class="email" style="width:200px;height:100px;background:skyblue; font-size:16px;color:red;">
<?php echo $username; ?><br><br>
<?php echo $emailname; ?>
</div>
above code is working successfully.just follow thant one.
On Thu, May 16, 2013 at 4:11 PM, Santosh Verma <santosh.verma574@gmail.com> wrote:
how to use mulltiple dropdown list,checkbox ,radio buttons in cake-php in registration page?
On Wednesday, 14 September 2011 22:11:21 UTC+5:30, tubiz wrote:Please I have a register action in my user controller how do i send a--
mail to a user after he has successfully registered and his details
has been stored in the database.
I would like to use Google SMTP to send the mail.
How do I also send a mail to all registered users as well.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment