Skip to content

Instantly share code, notes, and snippets.

@sibysathyanesan
Created December 12, 2019 05:53
Show Gist options
  • Save sibysathyanesan/646c080ca2f18c639bf34c1059a518c4 to your computer and use it in GitHub Desktop.
Save sibysathyanesan/646c080ca2f18c639bf34c1059a518c4 to your computer and use it in GitHub Desktop.
Mail using SMTP php
function mail_test() {
// gamil smtp config
/* $config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'hotmttknhlcudrtr',
'charset' => 'utf-8',
'priority' => 1,
'charset' => 'iso-8859-1',
'mailtype' => 'text'
); */
// cpanel mail config
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://mail.steerforth.in',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'nJv^%-3iu^jE',
'priority' => 1,
'charset' => 'iso-8859-1',
'mailtype' => 'html'
);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'active-matrimony');
$this->email->to('[email protected]');
$this->email->subject('Test email');
$this->email->message('activate user link is a test mail');
$mail_send = $this->email->send();
if($mail_send)
{
echo "mail success";
} else {
echo "email failed". $this->email->print_debugger();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment