CodeIgniter Forums

Full Version: Sending EMail From Code Igniter 2.0.1
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3

El Forum

[eluser]raiser[/eluser]
Hello everyone,

I am new to code igniter as well as this forum. I have been learning CI for past 1 week.. This is my first post in this forum.

Now i want to send mail.. So you people kindly guide me to send mail..

What are the basic steps i should follow?

What are the changes should be done in the Email.php Library file?


Waiting for your reply.. Pls help me..


Thanks & Regards,

Raiser

El Forum

[eluser]LuckyFella73[/eluser]
Hi Raiser,

first of all welcome to the codeigniter forums!

Regarding your question:
Basically it can't be described more clearly than in the CI userguide:
http://ellislab.com/codeigniter/user-gui...email.html

Btw: you don't to change anything in the email library. What you do is
setting some config items which are passed to the library and there you go.

El Forum

[eluser]raiser[/eluser]
Thanks for your reply.. This is the first reply i am getting in this forum...

I need to confirm one thing.. Will this mail script work in localhost? Because i am trying in local host only..

El Forum

[eluser]LuckyFella73[/eluser]
This script can work on localhost if you have a mailserver installed.

If you just want to test on localhost you can comment out this line:
Code:
$this->email->send();

And debug:
Code:
echo $this->email->print_debugger();

El Forum

[eluser]InsiteFX[/eluser]
You can also download this free email server tool that I use!

Test Mail Server Tool

InsiteFX

El Forum

[eluser]LuckyFella73[/eluser]
@InsiteFX: Nice hint! Setting up Mercury allways seemed to be too much hassle for me,
this one is exactly was I was hoping to find one day Wink

Easy to install and enough functionality for testing purposes. Thank you!

El Forum

[eluser]raiser[/eluser]
Thanks InsiteFX and LuckyFella73 for replying me...

I have installed the mail server.. What should i do next? i tried with some code but still i got error message only.

My code is,

Code:
class Task extends CI_Controller {
        function index()
        {
            $config    =    array(
                        "protocol"     =>     "sendmail",
                        "mailpath"     =>    "/usr/sbin/sendmail",
                        "charset"    =>    "iso-8859-1",
                        "wordwrap"    =>    TRUE
                        );
            $this->load->library('email', $config);
            $this->email->initialize();
            
            $this->email->from('[email protected]');
            $this->email->to('[email protected]');
            $this->email->subject('Code igniter Test');
            $this->email->message('Test Test Test');
            $this->email->send();
            
            echo $this->email->print_debugger();
        }
    }

Kindly help me to solve this issue..

El Forum

[eluser]Madmartigan1[/eluser]
I'm wondering the same.
@InsiteFX how did you get this configured? I haven't tried to use a local mail client in quite some time (windows xp era). I had some junky one called PostCast that was good for testing, this one looks perfect! Like @luckyfella73 said, been looking for something like this for a long time!

Installed it, tried a few different settings in config/email.php, restarted server but no luck yet.

El Forum

[eluser]daniel ispas[/eluser]
The send email code is good. The problem seems to be with your mail server.

El Forum

[eluser]InsiteFX[/eluser]
You have to use the email classes smtp config! When I installed it defaulted to smtp port 25

When you start it, it will place an icon in the taskbar right click then options and it will tell you what your smtp port is!

InsiteFX
Pages: 1 2 3