Welcome Guest, Not a member yet? Register   Sign In
EMAIL CLASS Cannot send email
#1

Hi,

I am stumped. I am trying to send an email with the email class with no success. I have tried both SMTP and SENDMAIL and I know I am doing SOMETHING wrong but I don't know what.

My code is this:

PHP Code:
public function emailtest(){
 
date_default_timezone_set('America/New_York');
 
 
$this->load->library('email');
 
 
 
//Now the code to send the email
 
$config['protocol'] = 'sendmail';
 
$config['mailpath'] = '/usr/lib/sendmail -t -i';
 
$config['charset'] = 'iso-8859-1';
 
$config['wordwrap'] = TRUE;
 
$config["smtp_host"] = "localhost";
 
$config["smtp_user"] = "[email protected]";
 
$config["smtp_pass"] = "somepass";
 
$config["smtp_port"] = 587;
 
$config["mailtype"] = "text";
 
$config["crlf"] = "\n";
 
$config["newline"] = "\n";
 
$this->email->initialize($config); 
 
 
$this->email->from("[email protected]";
 
$this->email->to('[email protected]');
 
 
//$emailText = "This is a test";
 
 
$this->email->subject("test");
 
$emailText "This is the text of an email";
 
$this->email->message($emailText);
 
$this->email->send();
 
 
ini_set("smtp_port"587);
 
mail("[email protected]","This is a test""This is the message""From: [email protected]");
 
 echo 
"<h1>The email was sent</h1>";
 } 

Now, the email class doesn't work. However, the standard mail() call seems to work perfectly. Any idea what I am doing wrong here?

Thanks in advance for your assistance.
Reply


Messages In This Thread
EMAIL CLASS Cannot send email - by bazianm - 09-05-2016, 06:57 PM
RE: EMAIL CLASS Cannot send email - by InsiteFX - 09-06-2016, 03:48 AM



Theme © iAndrew 2016 - Forum software by © MyBB