Question Detail

How to fix "This message may not have been sent by: : sender@gmail.com.." warning, when i send it through mail() function php from my website??

6 years ago Views 1511 Visit Post Reply

This message may not have been sent by: sender@gmail.com
please provide me solution for above message when i send it through mail() function php from my website.


Thread Reply

Anonymous

- 6 years ago

you can configure it on the fly or set your preferences in a config file. I used the following code: 

 function sendMail()
 {
     $config = Array(
    'protocol' => 'smtp',
    'smtp_host' => 'ssl://smtp.googlemail.com',
    'smtp_port' => 465,
    'smtp_user' => 'xxx@gmail.com', // change it to yours
    'smtp_pass' => 'xxx', // change it to yours
    'mailtype' => 'html',
    'charset' => 'iso-8859-1',
    'wordwrap' => TRUE
  );

       $message = '';
       $this->load->library('email', $config);
       $this->email->set_newline("\r\n");  
       $this->email->from('demo@gmail.com'); // change it to yours
       $this->email->to('demo@gmail.com');// change it to yours
       $this->email->subject('Subject kya hoga');
       $this->email->message('QnA Site very helpfull for Developers. ');
     if($this->email->send())
     {
       echo 'Email sent.';
     }
     else
     {
      show_error($this->email->print_debugger());
     }

 }