Contact form mail not sending in codeigniter -


hi newer in codeigniter.. in website add contact form , send mail gmail. try in local xampp server working fine. once host in godaddy server getting error severity: warning message: fsockopen(): unable connect ssl://smtp.gmail.com:465 (connection timed out) filename: libraries/email.php line number: 2063

this view code :

<div id="contactform">             <form id="contact" action="contactform" method="post">               <fieldset>               <div class="row">                 <div class="five columns">                   <label for="name" id="name_label">your name: <span class="required">*</span></label>                   <input type="text" name="name" id="name" size="50" value="" class="text-input" required=""/>                   <label for="email" id="email_label">your email address: <span class="required">*</span></label>                   <input type="email" name="email" id="email" size="50" value="" class="text-input" required/>                   <label for="subject" id="subject_label">subject</label>                   <input type="text" name="subject" id="subject"  value="" class="text-input" />                 </div>                 <div class="seven columns">                   <label for="msg" id="msg_label">your message: <span class="required">*</span></label>                   <textarea cols="60"  name="msg" id="msg" class="text-input" required></textarea>                   <br />                   <input type="submit" name="submit" class="button" id="submit_btn" value="send message"/>                   <br class="clear" />                 </div>               </div>               </fieldset>             </form>         </div> 

this controller code

public function contactform(){               //get form data             $name = $this->input->post('name');             $from_email = $this->input->post('email');             $subject = $this->input->post('subject');             $message = $this->input->post('msg');              //set to_email id want receive mails             $to_email = 'antoalexander@gmail.com';              //configure email settings              $config['protocol'] = 'smtp';                 $config['smtp_host'] = 'ssl://smtp.gmail.com';                 $config['smtp_port'] = '465';             $config['smtp_user'] = 'antoalexander@gmail.com';             $config['smtp_pass'] = 'xxxxxxx';             $config['mailtype'] = 'html';             $config['charset'] = 'iso-8859-1';             $config['wordwrap'] = true;             $config['newline'] = "\r\n"; //use double quotes             //$this->load->library('email', $config);             $this->email->initialize($config);                                      //send mail             $this->email->from($from_email, $name);             $this->email->to($to_email);             $this->email->subject($subject);             $this->email->message($message);             if ($this->email->send())             {                 // mail sent                 $this->session->set_flashdata('msg','<div class="alert alert-danger text-center">thanks contacting us! contact soon..</div>');                 $this->load->view('layouts/head');               $this->load->view('contact');             $this->load->view('layouts/footer');             }             else             {                 //error                 $this->session->set_flashdata('msg','<div class="alert alert-danger text-center">there error in sending mail! please try again later</div>');                  $this->load->view('layouts/head');              $this->load->view('contact');             $this->load->view('layouts/footer');             }          } 


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -