CodeIgniter From Scratch: Day 3
videos

CodeIgniter From Scratch: Day 3. Sending Emails

This entry is part 3 of 17 in the CodeIgniter From Scratch Session
« PreviousNext »

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


Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://www.jeff-way.com Jeffrey Way
    Author

    Shoot – there seems to be an audio/video sync issue. May have to upload a new version shortly.

  • Gonzalo

    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! :)

    • http://www.jeff-way.com Jeffrey Way
      Author

      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.

  • http://adrusi.com/ adrusi

    OMG!!! you can’t stop these great CI tuts!!!

  • Jermaine Hercules

    I have been trying to send email with php all day and now this greate timing

    • Jermaine Hercules

      keep up the good work jeff

      • http://www.jeff-way.com Jeffrey Way
        Author

        Thanks, Jermaine! Let me know if you have any questions.

  • http://ronny-andre.no Ronny-André Bendiksen

    FINALLY! Been waiting for this for quite some time now. Keep em coming!

  • Mike

    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

      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

        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.

    • http://timmw.co.uk Tim

      I think the idea is to learn the skills then pull them all in together at the end.

    • Cecily

      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.

    • Jeff

      We know how to create a website and add content to it via the last two (even just the first) tutorial. He didn’t go through creating page by page — but that would be a pointless and long tutorial. Use the information in the first one (and second) and create your own website. When you’re done, come back here, learn how to send emails, and create a contact page for your site…
      I’m not sure what you’re looking for… a tutorial creating a complete website including content… should we watch him type it all in?

  • http://www.imblog.info Muhammad Adnan

    jeffrey is a good teacher , i like his videos .

    keep it up.

  • Matthew

    Digging these codeigniter tuts! Can’t get enough

  • Imamu Hunter

    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.

    • http://www.jeff-way.com Jeffrey Way
      Author

      Glad you’re enjoying them! :)

  • http://www.demogeek.com DemoGeek

    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.

    • http://www.jeff-way.com Jeffrey Way
      Author

      Zoom out? Not sure I understand. Do you mean zoom in? Are you watching in full screen?

  • Jason

    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

      I was wondering the same thing.

      • http://www.robinmitra.com Robin

        Same here!

  • Kyle

    Nice job Jeff. I am loving this CI series.

    Keep em coming!!!!

  • Niklas

    Just want to thank you for these videos, very good work on a very interesting framework. Keep them comming! :)

  • http://www.hobbes.ch Thomas Keller

    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

    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.

    • http://www.jeff-way.com Jeffrey Way
      Author

      I’ll commit to at least 10. But hopefully more. :)

      • http://www.freshclickmedia.com Shane

        Great stuff!!!

  • http://jonpiehl.com Jon Piehl

    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

    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 )…

  • http://www.dizzytree.com Brad Madigan

    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!

    • http://jonpiehl.com Jon Piehl

      I would like to know how to handle both HTML and Plain Text emails as well. Thanks!

  • Cesar

    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.

  • http://laranzjoe.blogspot.com lawrence77

    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….. :D
    change it quickly, before others do… :P

    • http://www.jeff-way.com Jeffrey Way
      Author

      Oh I don’t really care about that account. I’ll just create a new one. :)

      • http://laranzjoe.blogspot.com lawrence77

        Oops someone change that password…. :cry:

  • http://mike-mcmullan.com Mike McMullan

    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.

  • http://www.websitementors.com Louisville Web Design

    You all have the best tutorials. I learn new things each time I read one.
    Thanks,

  • Andrew Johnston

    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

    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

    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

    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

    Why u dont simply use base_url() instead $_SERVER['DOCUMENT_ROOT'] ?

    • http://www.jeff-way.com Jeffrey Way
      Author

      They’re different paths.

  • bballbackus

    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!

    • http://www.jeff-way.com Jeffrey Way
      Author

      Thank you. Thank you. :)

  • http://designblurb.com Sumesh

    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

    Good job Jeff!

  • http://www.twitter.com/arnold_c arnold

    you are so awesome Jeffrey…I really learn a lot with your tutorials, thanks

  • ibs

    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

    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

    Loud noises! Keep em coming please!

  • http://pixelcraftwebdesign.com/ KevinBrown

    Great! Thanks a lot!

  • http://blog.davidrojas.net David Rojas

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

    • http://jonpiehl.com Jon Piehl

      The NetTuts screencasts can be downloaded as Podcasts for iPod/iPhone compatibility through iTunes. Just search “NetTuts”.

      • http://blog.davidrojas.net David Rojas

        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

    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,

  • http://www.traeregan.com Trae Regan

    …being LOUD per your request in the screen-cast. Please do continue the CI tuts series. Great work, thanks!

  • Dave

    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

    “Look to check to see” :P

    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

    Great easy to understand tutorial. Can’t wait for day 4.

  • Erwan

    Excellent as usual.

  • Shaun C.

    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

    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.

    • http://www.twitter.com/NeilBradley Neil Bradley

      @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

        That was a big help! thanks! I thought I had to do this but I wasn’t entirely sure.

      • Chris

        I notice that in Jeff’s code he doesn’t take out the $config.

      • Harry

        I was just having that problem, and now its sorted. ta much

      • Dhaval

        Thanks a lot .. it helped :)

  • Mike

    Loving this series, although very familiar to CI never hurts to check out the basics again.

    Keep it up!

  • Paul

    All his tutorial are very good.

    Great and easy follow tutorial for CI-beginners.

    Thanks a lot!

  • Kenshin

    Great turorial, thank’s!

    I am really interested to see JQuery+CI to manage cool table effects.

    Keep up the good work!

    Kenshin

  • http://www.rawsterne.co.uk John Rawsterne

    I’ve watched all 3 tuts and learned new stuff from each of them. So thanks :D

    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

    Great tutorials, don’t stop them. I am learning CI and php for that matter and this has been great!!!!!

  • jeanv

    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)