can't send email using Code ignitor email library | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

can't send email using Code ignitor email library

// This is the controller part <?php class Email extends CI_Controller { function __construct() { parent::__construct(); $this->load->helper('form'); } function index() { $this->load->helper('form'); $this->load->view('example22)/email_view',array('error'=> ' ')); } function send() { $this->load->library("email"); $to = $this->input->post("email"); $subject = "Testing email"; $message = "This is the email for testing the email library"; $config['protocol']='smtp'; $config['smtp_host']='ssl://smtp.gmail.com'; $config['smtp_port']='465'; $config['smtp_timeout']='30'; $config['smtp_user']='abc@example.com'; $config['smtp_pass']='example'; $config['charset']='utf-8'; $config['newline']="\r\n"; $config['wordwrap'] = TRUE; $config['mailtype'] = 'HTML'; $this->email->initialize($config); $this->email->from("abc@example.com","abc"); $this->email->to($to); $this->email->subject($subject); $this->email->message($message); if($this->email->send()) { $this->load->view("example22)/email_success"); } else { $this->load->view("example22)/email_view",array('error'=>$this->email->print_debugger())); } } } ?> //This is the view part in which we will input an email <html> <head> </head> <body> <center> <h1><?= $error?></h1> <br><br><h2> You Email</h2> <br> <?php echo form_open('/email/send'); echo form_label("Email : "); $array1 = array( 'name' => 'email', 'id' => 'email', 'type' => 'email', 'required' =>'required' ); echo form_input($array1); echo("<br><br>"); $array2 = array( 'name' => 'send', 'value' => "Send", 'type' => "submit" ); echo form_input($array2); echo form_close(); ?> </body> </html> // and i am getting error like :- Fatal error: Maximum execution time of 30 seconds exceeded in C:\xampp\htdocs\ci\syste

22nd May 2018, 5:46 AM
Saurav Kumar
Saurav Kumar - avatar
0 Answers