tags:

views:

20

answers:

3

I'm creating templates for outgoing emails and a view seems like the best place for the template. The model is doing the handling of the actual email. So I wanted to see if I'm breaking any convention.

+1  A: 

No - a Controller is supposed to act as an arbitrator between models and views. You might consider using a helper function instead to create the template.

Justin Ethier
A: 

In my opinion you should create your email from the controller, the model should be use only to make operations in the Database.

Gerardo Jaramillo
+1  A: 

I would do it exactly as you are suggesting:

  1. Load the model from the controller.
  2. Have the model load a view as a string and set it as the message
  3. Send the email from the model.

If you we're sending views to browser for output, I'd keep all that stuff separate, but since you're sending emails, which is more data oriented, I'd keep all my email logic in one model... template loading, sending and all.

Oh yeah, and storing you're email template in a view is the absolute best thing to do.

bschaeffer