简体   繁体   中英

codeigniter email sent to spam

my model:

<?php
class email_model extends CI_Model {

    function __construct()
    {
        // Call the Model constructor
        parent::__construct();
    }

        public function sendEmail($from = null, $to = null, $subject = null, $message = null){

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

            $config['protocol'] = 'sendmail';
            $config['mailpath'] = '/usr/sbin/sendmail';
            $config['charset'] = 'utf-8';
            $config['mailtype'] = 'html';
            $config['wordwrap'] = TRUE;

            $this->email->initialize($config);

            $this->email->from('email@mydomain.com', 'Website name');

            $this->email->to($to);

            $this->email->subject($subject);

            $this->email->message($message);

            $this->email->send();

        }
}

my domain is hosted on GoDaddy also i have created an email there and redirect it to my gmail email...

why does my email is sent to spam folder and not on Inbox?

EDIT: my email content is basically an invitation welcome

Hello $email

$website has invited you to join the website

to join visit the following link

$link_goes_here

Thanks, the team

If you are using HTML to display your mail, you have to ensure that your mail is sent with valid html. You can validate your mail here: http://validator.w3.org/

如果是这样,请与我们联系。.也许您可以尝试通过Amazon SES发送电子邮件,所以google / yahoo认为它不是垃圾邮件。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM