CodeIgniter Forums
Sending EMail From Code Igniter 2.0.1 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Sending EMail From Code Igniter 2.0.1 (/thread-40141.html)

Pages: 1 2 3


Sending EMail From Code Igniter 2.0.1 - El Forum - 03-30-2011

[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


Sending EMail From Code Igniter 2.0.1 - El Forum - 03-31-2011

[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-guide/libraries/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.


Sending EMail From Code Igniter 2.0.1 - El Forum - 03-31-2011

[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..


Sending EMail From Code Igniter 2.0.1 - El Forum - 04-01-2011

[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();



Sending EMail From Code Igniter 2.0.1 - El Forum - 04-01-2011

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

Test Mail Server Tool

InsiteFX


Sending EMail From Code Igniter 2.0.1 - El Forum - 04-01-2011

[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!


Sending EMail From Code Igniter 2.0.1 - El Forum - 04-01-2011

[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..


Sending EMail From Code Igniter 2.0.1 - El Forum - 04-02-2011

[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.


Sending EMail From Code Igniter 2.0.1 - El Forum - 04-02-2011

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


Sending EMail From Code Igniter 2.0.1 - El Forum - 04-02-2011

[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