Yasser Moussa
Yasser Moussa

Reputation: 2329

Send SMTP email from cpanel

I am using godaddy shared hosting is there and of what i read that it's not possible to send emails using SMTP from a shared hosting is there any alternative way .. i am trying to send emails using codeigniter but it's not working at all

$this->email->clear();
                $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
                $this->email->to($user->email);
                $this->email->subject($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_forgotten_password_subject'));
                $this->email->message($message);

                if ($this->email->send())
                {
                    $this->set_message('forgot_password_successful');
                    return TRUE;
                }
                else
                {
                    $this->set_error('forgot_password_unsuccessful');
                    return FALSE;
                }

Upvotes: 1

Views: 1405

Answers (1)

Check: GoDaddy POP and SMTP Server Settings

Check the library configuration email, and your hosting provider looking email accounts created, select and view a manual configuration.

Documentation Codeigniter Email

<?php 
public function sendEmailSMTP(){
  $this->load->library("email");
  $configEmail = array(
    'useragent' => "CodeIgniter",
    'mailpath'  => "/usr/bin/sendmail", // or "/usr/sbin/sendmail"
    'protocol'  => 'smtp',
    'smtp_host' => 'URL',// URL check: http://www.yetesoft.com/free-email-marketing-resources/godaddy-pop-smtp-server-settings/,
    'smtp_port' => 465, // Usually 465
    'smtp_crypto' => 'ssl', // or tls
    'smtp_user' => 'youremail@yourdomain.com',
    'smtp_pass' => 'AccountPasswordEmail',
    'mailtype'  => 'html',
    'charset'   => 'utf-8',
    'newline'   => "\r\n"
   );    

  //Load config
  $this->email->initialize($configEmail);
  $this->email->from($this->config->item('admin_email', 'ion_auth'), $this->config->item('site_title', 'ion_auth'));
  $this->email->to($user->email);
  $this->email->subject(($this->config->item('site_title', 'ion_auth') . ' - ' . $this->lang->line('email_forgotten_password_subject'));
  $this->email->message($message);
  $this->email->send();

  // See result
  echo $this->email->print_debugger();

} // End sendEmailSMTP()

Upvotes: 1

Related Questions