0

This is my code:

 $config = array( 'protocol' => 'smtps', 'smtp_host' => 'ssl://smtps.googlemail.com', 'smtp_user' => '[email protected]', 'smtp_pass' => '******', 'smtp_port' => '465', 'mailtype' => 'html', 'smtp_timeout' => '4', 'newline' => "\r\n" ); $this->email->initialize($config); $this->email->to('[email protected]'); $this->email->cc();//$this->input->post('cctxt') $this->email->from('[email protected]'); $this->email->subject('Test subject'); $this->email->message('Test message'); $this->email->send(); echo $this->email->print_debugger(); 

This email is going into spam box.

13
  • 1
    Error shows failed to authenticate password. Make sure you are using correct login credentials Commented Oct 5, 2017 at 7:15
  • which hosting you're used....cpanel or windows Commented Oct 5, 2017 at 7:53
  • login credentials are correct. @BSB Commented Oct 5, 2017 at 9:47
  • Server is amzon @Mahesh Commented Oct 5, 2017 at 9:47
  • have you tried with tls and port 587..? Commented Oct 5, 2017 at 9:54

1 Answer 1

0

First, you have an error in the google's SMTP SERVER, it must look like

$config = array( 'protocol' => 'smtp', 'smtp_host' => 'ssl://smtp.gmail.com', 'smtp_user' => '[email protected]', 'smtp_pass' => '******', 'smtp_port' => '465', 'mailtype' => 'html', 'smtp_timeout' => '4', 'newline' => "\r\n" ); $this->email->initialize($config); $this->email->to('[email protected]'); $this->email->cc();//$this->input->post('cctxt') $this->email->from('[email protected]'); $this->email->subject('Test subject'); $this->email->message('Test message'); $this->email->send(); echo $this->email->print_debugger(); 

Then, for this to work you must enable access for less secure apps in your google account, since you are not using OAUTH.

Enable access For less Secure Apps

Good Luck!

Sign up to request clarification or add additional context in comments.

1 Comment

No when i am using this config aaray. Mail sending stop. My server is https so I need to use smtps. Now my issue is why it goes in spam

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.