Reputation: 327
So the code:
$this->load->library('email');
$this->email->from('[email protected]', 'mysite');
$this->email->to($email);
$this->email->subject('Email Test');
$this->email->message('Testing the email class.');
$this->email->send();
I can't understand why there is no errors when I send an email, but when I check my email box, there is no emails, so it looks like the email don't reaches his destination, I am using CodeIgniter, maybe i need to add some other settings to fix this?? please help!!
ps: I have also used the native mail() function, anyway the email doesn't comes, I was checking it in gmail
Your message has been successfully sent using the following protocol: mail
From: "mysite"
Return-Path:
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: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
=?utf-8?Q?Email_Test?=
Testing the email class.
is there something wrong?
Upvotes: 0
Views: 978
Reputation: 186
Strange! May be you should create an file email.php inside config folder.
add the following code in the file
$config['protocol'] = 'sendmail';
$config['mailtype'] = 'html';
$config['mailpath'] = '/usr/sbin/sendmail';
In your controller where you are sending email add a line before you set the to and from headers.
$this->load->library('email');
to make sure new settings are loaded.
Upvotes: 0
Reputation: 5104
Are you using this on a localhost server, or on a production server? If you are using your own installation of Apache, PHP and MySQL (such as manual installation, WAMP, XAMPP, MAMP, etc.), then you may not have a mail server installed on your localhost machine for sending mail.
Try the following:
mail('[email protected]', 'My Subject', 'Test message...');
If this does not work, then most likely you do not have a mail server installed on your server.
Upvotes: 2