[eluser]BenRob[/eluser]
Hi all I'm having a problem with email.
I've used this loads but I've just moved to rackspace and I'm having a problem.
If I use the PHP mail() function it works fine. but when I use the code below it doesn't work. It says the email has been sent using the debugger but nothing in my inbox. Any help would be much appreciated.
Quote:Your message has been successfully sent using the following protocol: sendmail
User-Agent: CodeIgniter
Date: Thu, 26 Nov 2009 15:59:20 +0000
From: "The Garden"
Return-Path:
To: [email protected]
Subject: Password Reset
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="B_ALT_4b0ea5d842e0a"
This is a multi-part message in MIME format.
Your email application may not support this format.
--B_ALT_4b0ea5d842e0a
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Hi ,\n\nAs requested, your password has been reset. Here are your login
details :\n\nusername: \npassword: m6pk0db0\n\nOnce you have logged in you
can change your password to something that you find easier to
remember.\n\n
--B_ALT_4b0ea5d842e0a
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
<p>Hi, </p><p>As requested, your password has been reset. Here are your log=
in details :<br />username: <br />password: m6pk0db0</p><p>Once you have lo=
gged in you can change your password to something that you find easier to r=
emember.</p>
--B_ALT_4b0ea5d842e0a--
Code:
$HTML_message = '<p>Hi, '.$userdetails->first_name.'</p>';
$HTML_message .= '<p>As requested, your password has been reset. Here are your login details :<br />username: '.$userdetails->email.'<br />password: ' . $new_pass . '</p>';
$HTML_message .= '<p>Once you have logged in you can change your password to something that you find easier to remember.</p>';
$HTML_message .= '<p>' . base_url() . 'auth</p>';
$non_HTML_message = 'Hi '.$userdetails->first_name.',\n\nAs requested, your password has been reset. Here are your login details :\n\nusername: '.$userdetails->email.'\npassword: ' . $new_pass . '\n\nOnce you have logged in you can change your password to something that you find easier to remember.\n\n' . base_url() . 'auth\n\n';
$this->email->initialize(array(
'protocol' => 'sendmail',
'mailpath' => '/usr/sbin/sendmail',
'mailtype' => 'html',
'charset' => 'iso-8859-1',
'wordwrap' => FALSE,
));
// Email their details
$this->email->from('[email protected]');
$this->email->to($this->input->post('forgotten_email'));
$this->email->subject('Password Reset');
$this->email->message($HTML_message);
$this->email->set_alt_message($non_HTML_message);
$this->email->send();