I am trying to do something like below: When a user hits the 'sign up' button, I have to send two emails (one to admin, one to user) and then the redirection. Currently, there is a lag of around 5 seconds before user gets redirected to the welcome page after he hits the sign up button. I am wondering is there any way in Codeigniter or in php that I can make the two calls to send email asynchronous. Both the functions (sendEmailToAdmin()
and sendPendingApprovalEmailToUser()
) exist in the controller. Sincere thanks in advance for the help.
$this -> users_model -> set_user();
$this -> sendEmailToAdmin();
$email = $this -> input -> post('email');
$this -> sendPendingApprovalEmailToUser($email);
redirect('welcome');