CodeIgniter Forums

Full Version: Send Mail() using CodeIgniter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Coder Death[/eluser]
Hello to all,

I am getting problem using the CodeIgniter send_mail() function

This is whatI have done in the Email file under the system/library folder

Code:
var $useragent = "CodeIgniter";
var $mailpath = "/usr/sbin/sendmail"; // Sendmail path
var $protocol = "smtp"; // mail/sendmail/smtp
var $smtp_host = "ssl://smtp.googlemail.com";
var $smtp_user = "[email protected]";  // SMTP Username
var $smtp_pass = "mypwd";  // SMTP Password
var $smtp_port = "465";  // SMTP Port
Now I set my PHP file with this

Code:
[mail function]
; For Win32 only.
SMTP = smtp.gmail.com
smtp_port = 465

Then inside my controller, I do this
Code:
$this->load->library('email');
$this->email->from('[email protected]', 'Name Surname');
$this->email->to('[email protected]');
$this->email->cc('');
$this->email->bcc('');

$this->email->subject('Hello my friend');
$this->email->message('This is a mail from CodeIgniter\r\n');

if (!$this->email->send())
      show_error($this->email->print_debugger());
else
      echo 'Your e-mail has been sent!';

But I am still catching this errors
Code:
A PHP Error was encountered

Severity: Warning

Message: mail() [function.mail]: SMTP server response: 530 SMTP authentication is required.

Filename: libraries/Email.php

Line Number: 1539
Code:
A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at C:\www\_sys\_sys_files\core\Exceptions.php:185)

Filename: core/Common.php

Line Number: 442

Want can be the error here? please
Do I need to set up a SMTP Server?

El Forum

[eluser]Coder Death[/eluser]
Humm I uncomment the OpenSSL extension in Php.ini
Now getting this error
Code:
A PHP Error was encountered

Severity: Warning

Message: mail() [function.mail]: Failed to connect to mailserver at "ssl://smtp.googlemail.com" port 465, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

Filename: libraries/Email.php

Line Number: 1539