1

I know this is a common question. But I tried a lot to solve, still I couldn't figure out the reason for this error.

I get the following error. enter image description here

Actually this is the first error of set of errors. My controller function is as follows:

public function index(){

  $config['useragent']    = 'CodeIgniter';
  $config['protocol']     = 'smtp';
  $config['smtp_host']    = 'ssl://smtp.googlemail.com';
  $config['smtp_user']    = 'author@example.org';// Your gmail id
  $config['smtp_pass']    = '********';// Your gmail Password
  $config['smtp_port']    = 465;
  $config['smtp_crypto']  = "ssl";
  $config['smtp_timeout'] = 30;
  $config['wordwrap']     = TRUE;    
  $config['wrapchars']    = 76;
  $config['mailtype']     = 'html';
  $config['charset']      = 'iso-8859-1';
  $config['validate']     = FALSE;
  $config['priority']     = 3;
  $config['newline']      = "\r\n";
  $config['crlf']         = "\r\n";

  $this->email->initialize($config);

  $this->email->from('author@example.org', 'authorname'); //your gmail id & your name
  $this->email->to('recipient@example.org'); //receipient's email

  $this->email->subject('Email Test');
  $this->email->message('Testing the email class.');    

  $res = $this->email->send();
  if($res)
       {
           echo '<script>alert("You Have Successfully sent the mail!");</script>';

       }
       else{
           $this->session->set_userdata("message","Email Not Sent!");

       }

}

I have modified my php.ini file according to some tutorials as follows:

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = ssl://smtp.googlemail.com
; http://php.net/smtp-port
smtp_port = 465

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from ="admin@wampserver.invalid"

I'm using PHP 5.6.25 with WAMP server. One additional information - my email library has following code:

class CI_Email {
   var  $useragent      = "CodeIgniter";
   var  $mailpath       = "/usr/sbin/sendmail"; // Sendmail path

but actually there is no such file in the above mentioned path. I don't know whether this is the problem.

Please HELP me!!

RiggsFolly
  • 93,638
  • 21
  • 103
  • 149
Christeen
  • 65
  • 10

0 Answers0