Reputation: 105
am trying to send emails using codeigniter email library to send emails to users using the following settings
$this->load->library('email');
$this->email->from('[email protected]','Admin');
$this->email->to($recieverEmail);
$this->email->subject('Morgan MarketBook');
$this->email->message($message);
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'mail.server';
$config['smtp_port'] = 26 ;
$config['smtp_user'] = 'user' ;
$config['smtp_pass'] = 'password' ;
$config['newline'] = "\r\n";
?>
my problem that the received emails are in the junk mail and not in the inbox...what is causing this problem ?
Upvotes: 1
Views: 7323
Reputation: 3412
Mail getting into junk instead of inbox isn't code related or codeigniter related for that matter. You have to follow some guidelines in order for the email not to be considered spam: Some of these guidelines are:
there are lots of guidelines for sending valid emails with php, just google "best practice for sending emails php"
Also, don't include your login credentials to your mail server. Cheers
Upvotes: 4
Reputation: 194
I beleive the problem is in your server, not in your CodeIgniter code. Try sending e-mail from the same e-mail address using a mail client. If you still receive the e-mail in the Junk mail you should contact your hosting provider and tell them about this problem, but my experience shows that they cannot do nothing about it.
Upvotes: 1