At the request of some of our readers, this week, we'll examine just how easy it is to send emails with attachments using Gmail. With raw PHP, this would be a long and tedious task. However, with CodeIgniter, it's a cinch! I'll show you how in this eighteen minute video tutorial.
Catch Up
Day 3
- Follow us on Twitter, or subscribe to the Nettuts+ RSS Feed for more daily web development tuts and articles.
Related Posts
Check out some more great tutorials and articles that you might like
Plus Members
Source Files, Bonus Tutorials and
More for $9 a month for all TUTS+
sites in one subscription.











User Comments
( ADD YOURS )Jeffrey Way August 4th
Shoot – there seems to be an audio/video sync issue. May have to upload a new version shortly.
( )Jeffrey Way August 4th
Until then – watch it here: http://blip.tv/file/2438089?filename=NETTUTS-CodeIgniterDay3853.m4v
( )Jeffrey Way August 4th
Uploading the replacement now.
Gonzalo August 4th
Thank you very much for your tutorials. Is there any chance that you put the code, too? In the previous tutorials the code was incomplete or had some errors, it would be nice if you could check that out. Thanks in advance!
( )Jeffrey Way August 4th
What errors did it have? I attach the exact files that I use when recording the screencast. The code is available if you click the big “Download” link.
( )adrusi August 4th
OMG!!! you can’t stop these great CI tuts!!!
( )Jermaine Hercules August 4th
I have been trying to send email with php all day and now this greate timing
( )Jermaine Hercules August 4th
keep up the good work jeff
( )Jeffrey Way August 4th
Thanks, Jermaine! Let me know if you have any questions.
Ronny-André Bendiksen August 4th
FINALLY! Been waiting for this for quite some time now. Keep em coming!
( )Mike August 4th
Interesting enough video, but how does it relate to the previous two? We’ve seen the very basics of creating page views, but nothing on actually pulling a site together and adding content to it, and now all of a sudden we are emailing users and allowing them to upload files!
Please, some kind of logical progression would be much more useful.
( )Jeff August 4th
I did it this way on purpose. CodeIgniter isn’t hugely complicated. If you’re familiar with basic HTML and php, you should be able to follow along just fine.
( )Mike August 4th
I can follow along no problem, it just seems to me that it would make much more sense to have some kind of basic site before we start emailing users and letting them upload files.
Tim August 5th
I think the idea is to learn the skills then pull them all in together at the end.
( )Cecily August 5th
I agree with Mike. Some people can learn by being shown some seemingly disconnected lessons and then have them strung together at the end, but others learn better when lessons are constructed progressively. I really appreciate the work you’ve done thus far – it’s increased my basic understanding of CI by tenfold – but I also wonder if I’m going to be stumped at the end because I don’t quite understand how or why all the pieces fit together.
That said, keep up the great work. This series is why I keep my tutsplus subscription.
( )Muhammad Adnan August 4th
jeffrey is a good teacher , i like his videos .
keep it up.
( )Matthew August 4th
Digging these codeigniter tuts! Can’t get enough
( )Imamu Hunter August 4th
man I love these videos. I’m taking a step back so I can fully learn php before I start using a framework but I learn so much on this site.
( )Jeffrey Way August 4th
Glad you’re enjoying them!
( )DemoGeek August 4th
Email.php under Config is something new to me…that should be the way to go to manage the code better. It would certainly help if you can zoom out the code a little bit so people can see better.
( )Jeffrey Way August 4th
Zoom out? Not sure I understand. Do you mean zoom in? Are you watching in full screen?
( )Jason August 4th
I’m trying to learn CodeIgniter, and these tutorials are a huge help!
One question: When you copied the email configuration to the config/email.php file, couldn’t you have just left those lines as they were rather than individually naming each key and copying the values, etc?
Or is that just a best-practice sort of thing for config files..?
( )Roeland September 11th
I was wondering the same thing.
( )Kyle August 4th
Nice job Jeff. I am loving this CI series.
Keep em coming!!!!
( )Niklas August 4th
Just want to thank you for these videos, very good work on a very interesting framework. Keep them comming!
( )Thomas Keller August 4th
This series is one of the best on nettuts, thanks for this!
Now, I am waiting for more on models, as I want to have a database with two related tables modelled….
Keep up the good work!
( )Joseph Wilson August 4th
PLEASE DON’T STOP THESE!!!!!
I hate it when some of these great tutorial series just…stop. It’d be great (like, super GREAT) if this one ran the whole distance.
You guys are doing an incredible job, here! Keep up the *incredible* work!
BTW, Jeff, thanks for listening to us. Your videos are amazing.
( )Jeffrey Way August 4th
I’ll commit to at least 10. But hopefully more.
( )Shane August 5th
Great stuff!!!
Jon Piehl August 4th
I agree with Mike. It would make more sense to follow a logical progression rather than jumping around to different topics. For instance, day 2 was about getting info from a database, day 3 should have been about inserting info into a database. Complete a topic before moving on. But don’t get me wrong, I love these tuts and I’m learning so much. Keep them coming!
( )IgnacioRV August 4th
Thanks Jeff for another useful screencast
Keep the good work and don’t even think about not continuing this series (you don’t have the feel… they ARE popular =P )…
( )Brad Madigan August 4th
Hi Jeff, this series is really giving me a great resource for possibly moving one of my applications to the CI framework.
I do have a suggestion however, in your tutorial you mentioned that you may or may not use the attachment. If you could, I would be interested in seeing how to handle both HTML and Plain Text versions of an email.
Thanks again. Great series!
( )Jon Piehl August 5th
I would like to know how to handle both HTML and Plain Text emails as well. Thanks!
( )Cesar August 4th
Hi Jeff, I love ALL your tutorials. I’ve learned a lot!!!!!
No offense… BUT PLEASE!!!!!! Stop making so many noises with your mouth!!!!!!
Again.. Thanks.
( )lawrence77 August 4th
Jeff the clarity of this is so cool…..
So continue with this clarity…;)
And the password of that nettutstutorials @ gmail.com
Is didnt changed, unfortunately i login into that account and see 3 mails…..
( )change it quickly, before others do…
Jeffrey Way August 4th
Oh I don’t really care about that account. I’ll just create a new one.
( )lawrence77 August 5th
Oops someone change that password….
Mike McMullan August 4th
Hey Jeff,
Great Job on this CI video series. I recently did a site with CI, you’ve shown me some better ways I should of done things. I don’t know If you have planned on doing this but, it would be great if you did a video about how to make a Members Area suing CI.
Keep up the great work.
( )Louisville Web Design August 4th
You all have the best tutorials. I learn new things each time I read one.
( )Thanks,
Andrew Johnston August 4th
Thanks for the CI series. I recently downloaded the framework and these are the perfect tuts for me to get a head-start in learning how to develop using CI.
Keep up the good work!
( )Keith Jackson August 4th
The requirement for the /r/n is in the RFC (not sure which one). Since you’re on a MAC, /r/n would not be sent automatically.
( )leo rapirap August 4th
i just watched the video, i’ve never thought sending emails using codeigniter framework is so much fun and easy.
i’ve been struggling sending emails using plain php, even drove to drinking
and pulling out my hair. pffft!
thank you so much jeff for posting this kind of tutorials.
keep it up jeff!
( )damon sharp August 4th
I agree with the comments pertaining to logical progression. Although I can follow just fine, it would be great to walk through building a site from scratch in more of a logical manner. Something more along the lines of the Wordpress for Designers series (minus the Photoshop portion). Thanks, and keep up the great work!
( )Piero August 4th
Why u dont simply use base_url() instead $_SERVER['DOCUMENT_ROOT'] ?
( )Jeffrey Way August 4th
They’re different paths.
( )bballbackus August 4th
Jeffery I just wanted to say I love these tutorials (codeigniter tuts, diving into php tuts, jQuery for absolute beginners) I watch them all religiously and I have to say you are a great teacher!
( )Jeffrey Way August 4th
Thank you. Thank you.
( )Sumesh August 4th
Finally, day 3 is in!
I might get thumbs down from others, but I really think you should put the remaining videos of CI from scratch on PLUS. That way, we’ll be assured that you won’t quit the series mid-way, it would be a shame to do so.
( )shiaw uen, tan August 4th
Good job Jeff!
( )arnold August 4th
you are so awesome Jeffrey…I really learn a lot with your tutorials, thanks
( )ibs August 4th
you are proving how worth you are as nettus editor. what a choice collis and the gang made. keep up the good work jeff as i am learning a lot from you.
( )Matt August 4th
Yes Yes!!!! Absolutely fantastic! Love your stuff, Jeff. I have been waiting on the edge of my seat for the last four days in anticipation. Keep it up!
( )Kyle August 4th
Loud noises! Keep em coming please!
( )KevinBrown August 4th
Great! Thanks a lot!
( )David Rojas August 4th
These tuts are great, don’t stop them! Just two suggestions:
( )Make them a bit more advanced, I think most of us already get the grips of basic stuff with CI, and please make them iPod/iPhone compatible (just like the rest of nettuts screencast).
Jon Piehl August 5th
The NetTuts screencasts can be downloaded as Podcasts for iPod/iPhone compatibility through iTunes. Just search “NetTuts”.
( )David Rojas August 6th
I know, I’ve been getting the screencasts that way since the beginning, but the CI series secreencasts aren’t working on iPhone/iPod, because the resolution is too high (iPod/iPhone accepts a max of 640×480 I think).
jakot August 4th
Hi Jeff and everybody here,
Right now Im trying to make a decision between choose Codeigniter or Zend Framework. Do you have any comment about it?
Thanks in advance,
( )Trae Regan August 4th
…being LOUD per your request in the screen-cast. Please do continue the CI tuts series. Great work, thanks!
( )Dave August 4th
Nice work on the CI tut. I agree with one of the comments above, put the rest of the series on PLUS
( )Martin Førre August 5th
“Look to check to see”
The “set_newline” method allows you to set what you want to use to make a new line in the email message, by default it’s “\n”, but to get it to comply with RFC 822 you have to use “\r\n”.
( )Ejaz August 5th
Great easy to understand tutorial. Can’t wait for day 4.
( )Erwan August 5th
Excellent as usual.
( )Shaun C. August 5th
Woooooo! Yaaaaah!! ((Bangs pots and pans together)
Keep this series going! Loving it, and makes me want to continue to come back for more!!
( )bvde August 5th
I have a notice from PHP
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: config
Filename: controllers/email.php
Line Number: 10 ($this->load->library(’email’, $config);)
It works the mail is sent. But i don’t find to get rid of this message.
Your tutorials are great and your accent is very easy to understand for a french speaking.
( )Neil Bradley August 8th
@bvde,
You will need to take out the $config.
Replace this line;
$this->load->library(’email, $config’);
with the following;
( )$this->load->library(’email’);
Chris September 22nd
That was a big help! thanks! I thought I had to do this but I wasn’t entirely sure.
Chris September 22nd
I notice that in Jeff’s code he doesn’t take out the $config.
Mike August 5th
Loving this series, although very familiar to CI never hurts to check out the basics again.
Keep it up!
( )Paul August 5th
All his tutorial are very good.
Great and easy follow tutorial for CI-beginners.
Thanks a lot!
( )Kenshin August 5th
Great turorial, thank’s!
I am really interested to see JQuery+CI to manage cool table effects.
Keep up the good work!
Kenshin
( )John Rawsterne August 5th
I’ve watched all 3 tuts and learned new stuff from each of them. So thanks
From a personal point of view, I’d love to see a tut about user authentication with CI.
Like how do we authenticate a user and then set privileges for that user.
Keep em coming!
( )Gregg August 5th
Great tutorials, don’t stop them. I am learning CI and php for that matter and this has been great!!!!!
( )jeanv August 5th
Hi, great stuff thanks for the video. Well sending email i easy with CI but it’s always good to have a look back to the basics!
Maybe you could have talked about the $this->email->clear(TRUE); for sendinf multiples emails.
A last thing, it would be maybe a good idea to post a link to each user guide page used in the tuto, for example:
email class: http://codeigniter.com/user_guide/libraries/email.html
… and is your software used for coding is avalaible on Windows ? (i’m using eclipse but your program seems to be well done for php object dev)
( )Tomos August 5th
Great tutorial.
The software he uses (I think) is textmate for Mac (http://macromates.com/).
( )Riad August 31st
Maybe you should try e-texteditor
( )http://www.e-texteditor.com/
jeanv August 5th
ok thanks Tomos
( )Dion Jensen August 5th
Great screencasts, being new to frameworks this is really helping me alot in understanding it
( )kamal August 5th
Hi,
thank you for that tutorial, but i search a tutorial about MVC Symfony.
plz if you have a idee, can you do it?
thanks.
( )Mathew August 5th
Jeff : You don’t need to write a constructor if all it does is call the parent, that’s bad practice. Another thing you did which didn’t make such sense was to put the document root variable into the CodeIgniter configuration file. You’re basically abstracting something which is incredibly easy to remember by default. What are you gaining from this?
It was a good tutorial, but nothing you couldn’t do if you just read the manual.
( )Jeffrey Way August 5th
You’re right about the constructor function; however, we’ll be adding to that method in future tutorials.
In reference to the new config item, I did that to demonstrate how you could add new keys to the config folder easily.
( )JJ August 5th
I wouldn’t mind seeing how CI could handle a basic membership site or user authorization.
Also, is it necessary to hide or take the configuration folders outside the public_html folder for security? CI security would be nice tut too!
Videos are great keep it going!
Many thank yous!
( )kman563 August 5th
Have loved all your tuts. Thanks a ton. Just started working with CI because of these vids.
( )Justin August 5th
Nice work Jeff! I’m enjoying this series a lot!
( )Jermaine Hercules August 5th
I got this error, can someone please help I stuck
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
Jon Piehl August 5th
You might not have set up the email configuration. Your app is trying to send an email through your localhost, but the localhost on your machine can’t send emails. You have to send an email through an email server (ie Gmail). Make sure you follow Jeff’s example on how to configure the email library to work with external email servers.
( )Jermaine Hercules August 5th
I did but now Message: fsockopen() is not enable i look in php.ini but cant find it anywhere. also im using a PC if that makes any difference
Mibu_Kyoshiro August 10th
Someone plzzz help….
I’m trying to recreate the tut using Wamp Server 2.0
I’ve enabled OpenSSL.
I still can send mail from my local codeigniter installation. I’ve tried everything from having the config settings in the controller to moving them into a email.php file
I STILL get the following error message: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: 1519
p.s Where is “Jeff’s example on how to configure the email library to work with external email servers.”?
Lorenzo August 5th
I love this kind of series tutorials! Good Work Jeff =)
( )Joakim August 5th
Love this serie, great tutorials! I really learn alot from them, thanks alot! =D
( )Dan August 5th
Great tutorial jeff!!
( )Mark Jones August 5th
Having some problems with Authentication, has someone changed the password or something? When I try and use my gmail account the page doesn’t load, simply gets stuck loading.
( )Jeffrey Way August 5th
Yeah – I think somebody did. Just use your own credentials.
( )Paul du Long August 5th
Hello Jeff,
Thanks for this tutorial! Just in time because I just needed it for a big new project.bI might have an improvement for you.
Because this new project I’m working on is queit big i have a lot of global data, such as email-address, sitename, siteUrl etc. What i did was; I created a new model within this model I defined those constants and then autoloaded this file via the autoload file.
I don’t know if this is the best way to do it but it works for me.
Let me know if this method works for you and I can’t wait for the next tutorial of CI.
Regards,
( )Paul du Long
Dean August 5th
Thanks for this brill CI series!!
( )When will this episode be available on iTunes?
Dion Jensen August 5th
Would it be possible for you to include the screencasts in the source file? I ask mainly so i can work offline while still watching them after i’ve downloaded them.
( )Jason August 10th
You can get them from itunes. Search nettuts. There’s a podcast.
( )Chris August 5th
Hey Jeff,
You are making my lunches on Tuesday or Wednesday great with these CI Tutorials. Keep it up!!!
Anyway you can go into some detail about HTML emails next week?
( )Jeffrey Way August 5th
Yes sir! What were we having for lunch?
( )marc-andre menard August 5th
Amazing…. I was in the decision to go native php for a site or with a framework, your guidance is just taking me to take the step i need to go with code igniter…
I will need some tutorial on database, get data, and show it. It will be cool to see that soon.
And the best of the best, a ci tuts to get data in a database and modify it and delete it… CRUD in fact
( )Jeffrey Way August 8th
Okay – I’ll do a CRUD tut in the next two weeks or so.
( )Joe August 5th
Definitely looking forward to more of these. I just watched all 3 and CI seems fun. Keep it up.
( )digitalbart August 5th
Good job Jeff! Keep these coming!
( )Paul du Long August 6th
Plzz help …. i keep getting this error:
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.googlemail.com:465 (Unable to find the socket transport “ssl” – did you forget to enable it when you configured PHP?)
Filename: libraries/Email.php
Line Number: 1646
PHPINFO SAYS OPENSSL IS ENABLED :S:S
( )Jermaine Hercules August 6th
I have this same problem, how I fixed was simply enabling php_openssl from you php.ini just php_opensll remove the ; good luck
( )Jeffrey Way August 7th
Yes – I should have mentioned that openssl needs to be enabled on some computers.
Dave Redfern September 13th
Hello Jermaine,
Could you explain exactly what you did to enable php_openssl? I’m running mamp but really struggling where to look and what to do.
Thanks
Dave.
paul August 9th
I have the same problem, I enabled openssl, but problem remains, even after I restarted apache
( )Ben August 6th
These are great video’s please keep them coming!!
( )Paul Demers August 6th
I am really enjoying these tutorials. I have been wanting to really learn CodeIgniter for a while now and just haven’t been able to wrap my head around it. This set of tutorials is really helping break it down. Great work as always!
( )SNaRe August 6th
When will new tutorial be released ? And what will be the content
( )Jeffrey Way August 7th
I’m shooting for every Monday/Tuesday.
( )Zac August 6th
This is so awesome! Please, more more!
( )fahri August 7th
I search all over Google to find best tips and tricks about CodeIgniter, and i think this is one of them. But you know i need more and more about CodeIgniter.
Anyone can tell me how to parse JSon with CI?
( )Mike August 8th
Hi you make great job . Thanks
( )mehdi August 9th
I’ll CI , specially in your tutorials . keep up the good work . can i share the sample application I have been write for you may be help for other tutorial .
( )sorry about misspell or grammar .
paul August 9th
I’m falling in love with codeigniter!
( )thank you so much for these tutorials.
It really takes the pain out of coding php.
Cuijiudai August 10th
I have just begin to learn some php frames,when I begin to find some tutoriols
( )I found it.Then I discide to learn CI .I think that php should be easy,fast and safe,why must we talk so much of OOP,just go itslef way ,why have to learn about java or ruby on rail.
last thing ,why “beginhtml” does not work in my e ,I see you can do it,and save a lot of time.thinks
Jason August 10th
Will there be a tut in this series on the CI form validation class? That’s one aspect of CI that I’m interested in.
( )GaVrA August 11th
Thanks jeff! Really great series, keep ‘em comming!
( )wtp August 11th
I’d like to see advanced forms, like nested forms, and how you mangage many-to-many relationships, that sort of stuff that I never mangaged to do with ruby on rails.
( )timo.huber August 12th
thanks so much.
))
( )i love these tuts
Chris August 12th
Hi Jeff,
Just got through days 1 to 3 of the CI tutorials. I’m excited that you’re taking the time to cover this framework.
I look forward to the next tutorial, keep at it.
Thanks,
-
( )Chris.
rootkowski August 12th
Great tutorial as always J!
Just a question: is it only me getting the same email twice every time I refresh the page? I’m testing the code on a local test server (xampp).
( )Mibu_Kyoshiro August 12th
Someone plzzz help….
I’m trying to recreate the tut using Wamp Server 2.0
I’ve enabled OpenSSL.
I still can send mail from my local codeigniter installation. I’ve tried everything from having the config settings in the controller to moving them into a email.php file
I STILL get the following error message: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: 1519
p.s Where is “Jeff’s example on how to configure the email library to work with external email servers.”?
( )Also, sorry for the double post! I’m not getting any responses on my original post
Jared September 11th
OK. I finally figured this out. Don’t know if this will help anyone, but I changed the wrong php.ini file. If you run the phpinfo command, toward the top, it will have a section called “Loaded Configuration File”. My location was at C:\xampp\apache\bin\php.ini, but I initially changed C:\xampp\php\php.ini with nothing working. Just thought I would pass it along.
( )Thomas Keller August 17th
I seem to have similar errors than the previous posters – when I use port 465, nothing happens (the page just loads and loads and loads…); using port 995 (which I found on some other internet resources to be the SSL port for gmail), I get
Message: fwrite() [function.fwrite]: SSL operation failed with code 1. OpenSSL Error messages: error:140D00CF:SSL routines:SSL_write:protocol is shutdown
Filename: libraries/Email.php
Line Number: 1789
Using port 586, I get
Message: fsockopen() [function.fsockopen]: SSL operation failed with code 1. OpenSSL Error messages: error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol
Filename: libraries/Email.php
Line Number: 1646
I am really confused now… Jeff, would be great to help out here
( )Kenny Vaneetvelde September 19th
I get the same error, jeff help us out please!
( )Magnus von Bromsen August 17th
Hello Jeff
Please, you must continue with the screencats’s.
I spent one week comparing and trying a couple of Frameworks. And decided to go with Codeigniter, mainly because of these fantastic screencast’s (and other good tutorials).
Don’t you dare to stop now
– magnus
( )Jeffrey Way August 18th
Thanks!
No way. New screencast sometime this week. (It’s been rescheduled a bit, due to our birthday celebration.
( )Richard S. August 19th
Great series. Looking forward to more of them.
And one more question. I really loved the colors you use for marking PHP code. Can you somehow write the colors down or share them in other way?
Would be great.
( )Steve K August 19th
Hi, Jeff!
Not sure if you’re still reading these, but I just have to say thank you! These tutorials are some of the most clearly communicated I’ve ever had the pleasure to watch. Thank you again, sir! How’s Australia treating you?
PS: If I have a request or an idea for a tutorial for nettuts, what’s the best way to offer my suggestion?
Thanks again!
( )Jeffrey Way August 19th
Thanks, Steve!
( )James August 28th
I’m enjoying this series a lot, keep them coming!
( )Alvin Crespo August 30th
Awesome tutorial. Ive been doing emails in php for a while and Im on day 4 right now after a two day marathon of this series and I am so impressed with what Code Igniter has to offer. I can most certainly see the power this framework has to offer and I’m impressed at your teaching style, its both professional and easy to understand. Keep them coming, I would love to see more. A few things I would like to see are: Regular Expressions for creating a Blog site like Drupal parsing content to automatically create p tags and break tags in a form body text area submission, database logic for joining tables in a code igniter based site, News aggregation using xml based feeds.
Again, great tutorial and now im onto week 5. Thanks!
( )emcgfx August 30th
Hey Jeff, in this tutorial the only thing I needed to add to my /controllers/email.php file is $config = $this->config->item(’config’); otherwise I got an error Message: Undefined variable: config
The rest worked perfectly. Thank you again for this good video. Good Job Jeff.
( )ci newbie September 25th
Can you tell me why? I got the same error when using the configuration file email.php in /config.
( )Nick August 31st
Wonderful screencasts. Keep ‘em coming. I’m even considering a net.tuts+ account.
( )Paolo Carpo September 2nd
Don’t konw if this can help but, anyway…
If you test all these thing on HostMonster, you should use ’sendmail’ instead of ’smtp’ in protocol, ‘cos smtp isn’t support on HM (this drives me crazy for about an hour
)
Thanks Jeffrey, you did a great job!!
( )Kujo September 3rd
Same problem of Paul
Message: fsockopen() [function.fsockopen]: unable to connect to ssl://smtp.google.com:465
I’ve already enabled php_openssl.dll
( )Paolo Carpo September 4th
try:
’smtp_host’ => ’ssl://smtp.googlemail.com’,
( )’smtp_port’ => 995,
Becky September 8th
I have this problem too, when I tried 995 it gave another error:
A PHP Error was encountered
Severity: Warning
Message: fwrite() [function.fwrite]: SSL operation failed with code 1. OpenSSL Error messages: error:140D00CF:SSL routines:func(208):reason(207)
Filename: libraries/Email.php
Line Number: 1789
Vincent C October 9th
Did you enable the it in the right file?
I have had this too and searched for hours for a fix but in the end I edited the wrong php.ini file.
I use Xampp, and edited xampp/php/php.ini but you should edit xampp/apache/bin/php.ini
Hope this helps!
( )Moyo September 11th
If you stop These wonderfull tutorials, I will come there and kill you. (just kidding)
But seriously though, Please go all the way.
I am forever grateful to your hard work and for sharing.
You will be referenced in all my future works.
( )Jeffrey Way September 11th
Thanks!
( )Martin September 14th
Wasn’t able to get this one working, hope day 4 is better.
Mac OS X 10.4.11
MAMP (Apache 2.0.59, PHP 5.2.6)
openssl extension installed & enabled
sendmail working with normal PHP
Tried ports 465, 586, 995. I get the same errors as Thomas Keller above.
At least I’m learning some CI, so thanks.
( )AzeriFire September 14th
Hi. I learn English language, proffesional coding style and CI in one tutorial
Dont stop it plz , just Music
Thanks.
( )RC September 15th
Holy Schniekes!
This tutorial is insane great! It truly saved my arse! Thank you so much Jeffrey! I’m so excited about Codeigniter since I’m fairly new to PHP (i’ve only been coding with it for about a year and I was already getting sick of spaghetti code.) It is only until recently that I have been learning about the wonders of frameworks and I love the simplicity of this one but even more, I love its documentation!
( )Edgar September 17th
Awesome tutorials dude
( )Kenny Vaneetvelde September 19th
okay, to everyone who is having issues sending the email (like those ssl errors, or that it keeps loading on port 465) i have found the answer!
i am pretty sure, in your code, you have this
$this->email->set_newline(’\r\n’);
‘ (single quote) should be ” (double quote, AKA magic quotes) and then it will work, strange, and sad, but true.
so change it to
$this->email->set_newline(”\r\n”);
( )Dmitri November 9th
Thank you. It worked for me
( )yura September 21st
instead
$this->email->set_newline(”\r\n”)
you can use
$config['newline'] = “\r\n” (only in double quotes)
in your email.php config file
and thanks for screencasts!
( )sunil September 21st
This is great and easer than cAkE
( )Dionis September 25th
Great work Jeff! Keep on doing this!
( )Brennan Novak September 27th
I loving the tutorials the most! Awesome job! Just purchased a Net-Tuts+
However, I keep getting these nasty errors
A PHP Error was encountered
Severity: Warning
Message: fsockopen() [function.fsockopen]: unable to connect to smtp.googlemail.com:25
Filename: libraries/Email.php
Line Number: 1646
First I realized that for some reason when I run it from my localhost via MAMP no email is ever sent even it gives the confirmation email… I’m about to update my MAMP version.
So then I uploaded a copy to my server and still got all the errors. I tried all of the suggestions above and the only solution that makes them go away and allow an email to be sent is remove the $config variable from this line:
$this->load->library(’email’, $config);
so it looks like this
$this->load->library(’email’);
and of course in which case I need to keep the config settings in that file… any thoughts or insights and this is very peculiar?
( )Brennan Novak September 27th
Ahhhhh figured it out. I’m a total tool. Misspelled “smtp_port” as “smtp_post”
( )Marshall September 29th
Hey Jeff, I just wanted to let you know first of all how awesome this framework is. I’ve never worked with one before, and so far it’s absolutely amazing. Second, your videos have been immensely helpful, please keep them up!
( )Kiruban PREMKUMAR October 4th
Hello Jeff,
Firstly, I want to thank you!!
You are doing a great Job!! Keep it Up!!
I wonder if you could deal with the creation of library, helpers, and the way we could integrate a live file uploading progress bar into codeigniter?
For example a screencast about the integration of uberupload or fancyupload…
It will be very nice!!
( )Allan October 8th
Yes I totally agree the nettuts is one of the best. They are being unselfish and shares a lot of things.
( )Ken October 14th
Be sure that your server firewall doesn’t block those ports or you will get nothing but errors. That’s what you get for using cheap hosting.
( )Ken October 14th
Nevermind! I was on Host Monster and a previous post mentioned to switch the protocol to sendmail instead of smtp and it worked all of the sudden. Yay for forums.
( )Sean Davies November 11th
Same here!
Bart October 26th
ERROR: My browser hangs on the send() function when trying to send email to a gmail account. Here’s my code:
$config = Array(
‘protocol’ => ’smtp’,
’smtp_host’ => ’ssl://smtp.googlemail.com’,
’smtp_port’ => 465,
’smtp_user’ => ‘accountname@gmail.com’,
’smtp_pass’ => ‘accountpass’
);
$this->load->library(’email’, $config);
$this->email->set_newline(’\r\n’);
$this->email->from(’accountname@gmail.com’, ‘Bart Schroder’);
$this->email->to(’accountname@gmail.com’);
$this->email->subject(’This is an email test’);
$this->email->message(’It works’);
if($this->email->send())
{
echo ‘Your email was sent. Great job!’;
}
else
{
show_error($this->email->print_debugger());
}
Can you help?
( )Balazs Csaba October 28th
Wooow…Thanx very much, great tutorials, keep on going!
Really apreciate what u’re doing…
Thx again
( )kdog October 31st
Great tutorial! Thanks.
( )Seday Matzumiya November 11th
Thanks man… great tutorials, i really like your way! Do you use Texter or something like that @ Mac?
Thank you.
( )dan November 18th
wont work for php 5.3
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci_day3\system\codeigniter\Common.php on line 130
Deprecated: Assigning the return value of new by reference is deprecated in C:\wamp\www\ci_day3\system\codeigniter\Common.php on line 136
source file needs to be updated
( )