Sending emails using CI

#1
[eluser]max123[/eluser]
I'm new to CI. Could any one please tell me how to send emails starting with the very first step. I tried email class but it gives me errors

#2
[eluser]khagendra[/eluser]
1. Load email library in ur controller.
Code:
$this->load->library('email');

2. use the following codes to send an email.
Code:
$this->email->from('sender email', 'Sender Name');   // $this->email->from('[email protected]', 'Your Name');
$this->email->to('receiver email');   //$this->email->to('[email protected]');

$this->email->subject('Subject of email');
$this->email->message('The message for the email.');

$this->email->send();

This will help to send an email.

#3
[eluser]max123[/eluser]
I tried. But it gives following error

A PHP Error was encountered

Severity: Warning

Message: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

Filename: libraries/Email.php

Line Number: 1519

#4
[eluser]praveens[/eluser]
you cont send mail using local system, upload your files to server and try it will works for u

#5
[eluser]sl3dg3hamm3r[/eluser]
[quote author="praveens" date="1256917558"]you cont send mail using local system, upload your files to server and try it will works for u[/quote]

yes you can, but you need to install a SMTP-service on your local developer-machine. Furthermore, I suggest to use phpmailer - class instead of CI's built-in mailer-class. It is more reliable, and more powerfull, yet easy to use. The CI-stuff are very skilled developers, for sure. But you could fill books only about mail-headers in general. In this field, the people behind phpmailer have simply more experience. With phpmailer I was successfull with tasks which I failed with CI's mailer-class.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.