[Catalyst] Sending Email from Page?

Octavian Rasnita octavian.rasnita at ssifbroker.ro
Tue Mar 29 12:02:08 GMT 2011


From: "Dave Howorth" <dhoworth at mrc-lmb.cam.ac.uk>
> John M. Dlugosz wrote:
>> On 3/27/2011 12:22 PM, Tomas Doran bobtfish-at-bobtfish.net
>> |Catalyst/Allow to home| wrote:
>>>
>>> And I would say that sending an email is a state change, and behavior
>>> of the application domain here.
>> That's a stretch, because you can argue that any side-effect is a change
>> of state to the universe at large and there happens to be no accessor to
>> read the results of the change.  It clearly matches "side effect", not
>> "state", unless you stretch the definition to make all side effects into
>> state and lose all distinction.
> 
> <stir> Sending an email isn't a side-effect or a state change, it's an
> output. And the thing that sends it isn't a controller or a model or an
> accessory, it's a View. Of course there may be specialized methods in
> the model as well. </stir>



IMHO, sending email is an action, part of the business logic, and not a view.
Sending email is not an output as well as inserting a record in a database or LDAP server are not outputs.

It doesn't matter that *maybe*, today, or tomorrow, or the next week somebody will access a POP3 server with an email client and will see that email message, as well as it doesn't matter if after a certain time somebody will read that record from the database or LDAP server with an appropriate client.

The views are usually very good to use the same data structure and generate an output in different formats, like csv/xls/xlsx... but very rarely we also need to generate other formats with the fields of an email message (To, Cc, Subject, body, attachments...) so it is also not very helpful to send email using a view.

Octavian




More information about the Catalyst mailing list