-2

I am using the following code to send mail

but the sent mail are going in spam. How can I mark them to not spam programatically

$this->load->library('email');

 if($this->config->item('protocol')=="smtp"){
            $config['protocol'] = 'smtp';
            $config['smtp_host'] = $this->config->item('smtp_hostname');
            $config['smtp_user'] = $this->config->item('smtp_username');
            $config['smtp_pass'] = $this->config->item('smtp_password');
            $config['smtp_port'] = $this->config->item('smtp_port');
            $config['smtp_timeout'] = $this->config->item('smtp_timeout');
            $config['mailtype'] = $this->config->item('smtp_mailtype');
            $config['starttls']  = $this->config->item('starttls');
             $config['newline']  = $this->config->item('newline');

            $this->email->initialize($config);
        }
            $fromemail='jodbaki@gmail.com';
            $fromname='Jod Baki';
            $subject=$this->config->item('activation_subject');
            $message=$this->config->item('activation_message');;

            $message=str_replace('[verilink]',$verilink,$message);

            $toemail=$this->input->post('email');

            $this->email->to($toemail);
            $this->email->from($fromemail, $fromname);
            $this->email->subject($subject);
            $this->email->message($message);
            if(!$this->email->send()){
             print_r($this->email->print_debugger());
            exit;
            }

I am sending the follwoing message

Hi,
 Thank you for registering with us. Please click below link to verify your
email address.
 <a href='http://jodbaki.com/exam/?/login/verify/'>Click Here</a>
 or
     Copy below link and visit in browser
 http://jodbaki.com/exam/?/login/verify/

 Thanks
Rohitashv Singhal
  • 4,517
  • 13
  • 57
  • 105

1 Answers1

0

Email services are responsible to find out if you are spamming. It has nothing to do with your code or codeigniter.

Try creating email under valid domain and prevent sending message contents that are spam like.

Here is an article to avoid your emails to be spam like:

Avoiding spam filters

TheDevWay
  • 1,363
  • 1
  • 16
  • 45