![]() |
Generating System emails - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Generating System emails (/showthread.php?tid=32527) |
Generating System emails - El Forum - 07-26-2010 [eluser]frist44[/eluser] I have a social app where I'm generating emails for registration, upload of content, comments, etc. I have each email subject, body, and associated keyword ("REGISTRATION") in a database. I have a model that grabs stuff from there, and then substitutes information like name, url, and other links a particular email may need. However, it just seems like I have to go through a lot of steps to add another email (add to database, add function to model, call it in the controllers...). How are you guys handling these? Generating System emails - El Forum - 07-27-2010 [eluser]frist44[/eluser] No one sends emails from their application? Generating System emails - El Forum - 07-27-2010 [eluser]mddd[/eluser] I like to put my emails into views. I make a folder 'emails' inside the view folder for that. Often, emails are sent at the same time as saving changes to the database. For instance, an application that allows a user to save something to a calendar. There could be a Calendar model that takes care of those changes. Then you get something like this: Code: class Calendar extends Model If every email is going to a registered user, you could make it a bit shorter by adding a small email-sending library to take care of recurring actions: Code: class Calendar extends Model Code: function send($email_type, $user_id, $data) |