My project is in codeigniter, i am sending mails in it with following code snippet, its working fine, just problem is that mail are going into spam folder of users, why this is happening, please suggest me the changes in following code snippet.
My Code Snippet:
$subject = 'Test Subject';
$config['protocol'] = 'smtp';
$config['smtp_host'] = "localhost";
$config['smtp_port'] = "25";
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$config['bcc_batch_mode'] = TRUE;
$config['crlf'] = '\r\n';
$config['newline'] = '\r\n';
$this->email->initialize($config);
$this -> load -> library('email');
$msg = "Test Message";
$this -> email -> from('admin@domain.com','Domain Name');
$this -> email -> to('user@gmail.com');
$this -> email -> subject($subject);
$this -> email -> message($msg);
$this -> email -> send();
What is settings to prevent mail from spam folders??