CodeIgniter Forums
Sending Emails on godday using codeigniter - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: General (https://forum.codeigniter.com/forumdisplay.php?fid=1)
+--- Forum: Lounge (https://forum.codeigniter.com/forumdisplay.php?fid=3)
+--- Thread: Sending Emails on godday using codeigniter (/showthread.php?tid=65962)



Sending Emails on godday using codeigniter - kash18 - 08-16-2016

Hello any one out to help, i am kinda having a lot of problems to sending emails when i upload my application to the godaddy servers


RE: Sending Emails on godday using codeigniter - skunkbad - 08-16-2016

So show some code. You probably are forced to use SMTP with Godaddy.


RE: Sending Emails on godday using codeigniter - kash18 - 08-18-2016

email.php //configurations
<?php
    $config['protocol']    = 'smtp';
    $config['smtp_host']    = 'ssl://smtp.gmail.com';
    $config['smtp_port']    = '465';
    $config['smtp_timeout'] = '7';
    $config['smtp_user']    = '[email protected]';
    $config['smtp_pass']    = '*************';
    $config['charset']    = 'utf-8';
    $config['newline']    = "\r\n";
    $config['mailtype'] = 'html'; // or html
    $config['validation'] = TRUE; // bool whether to validate email or not  
?>

and then sending controller
Test controller

<?php

class Test extends CI_Controller {

    public function index()
    {
        $function = new Users_M();

        $email_to  = "[email protected]";
        $subject   = "Test Message";
        $message   = "message";
$username = "kash";$title="Message";
        if($this->sendmail($email_to,$subject,$message,$username,$title,$message))
        {
            echo "Message Sent";
        }
        else
        {
            echo "Message NOT Sent";
        }
    }

          //send email to user
public function sendmail($email_to,$subject,$message,$username,$title,$message)
{    
     $this->config->load('email', TRUE);
    $mail_config = $this->config->item('email');
    
      $data = array(
             'username'=> $username,
             'title'  => $title,
             'content' => $message,
                 );
                 
    $this->load->library('email'); // load email library
    $this->email->initialize($mail_config);
    $this->email->set_newline("\r\n");
    
    $this->email->from($mail_config['smtp_user'],$mail_config['website_name']);
    $this->email->to($email_to);
    $this->email->subject($subject);
    $this->email->message($message);
    if ($this->email->send(FALSE))
        return TRUE;
    else
        return FALSE;
}

}
?>