Forums / Setup & design / Email Question
Arran Price
Sunday 13 March 2005 12:58:13 pm
Hi, I would like to take the output of one my templates and send it as an email. The email should be html formatted so images and formatting etc show up.The email could be sent by clicking on a button or better yet would be set up automatically do it once per week at a set time.
Whats the best way of approaching this?
Im not really sure to start this so any help appreciated.
Arran
Paul Forsyth
Sunday 13 March 2005 2:24:07 pm
A couple of pointers.
First of all all emails sent from eZ derive from a template. So anything you put into the template will be emailed, which includes any html.
Im not 100% sure if the email headers need to specify whether mail is http or not. A quick google around the web can find that out.
When you need to process something a little more its better to drop down to php. If you create a simple module/view you should be able include your template and fire it off in an email.
A cronjob can handle the automation part.
Hope this helps a little.
paul
Sunday 13 March 2005 5:17:00 pm
thanks Paul.Im still a little confused. I figure I will go the automation route. So can you (or anyone else) just confirm Im on the right track?
I have a template that gives me the correct output (Im currently using with an override for a node). So next up I need to create a module which will do the emailing? Then create a script that runs the module?or Is the script enough to put in cron and reference/send the template output?
Are there any examples or documentation (I couldnt find any) on how to do this. Ive got the documentation from the book which explains a bit, but Im still confused as to how the actual email gets created and how the template output is used in it.The closest examples I found where the tip a friend and feedback templates but I couldnt determine what actually sends the email.
Ive done alot with templates but I havent created and modules and my php skills are fairly limited.
Monday 14 March 2005 12:14:18 am
The module and cronjob/automation are entirely seperate. But both can use the same template that you can create.
Have a read of the docs on module creation:
http://ez.no/ez_publish/documentation/development/extensions/module/module_tutorial_part_1
I think other docs exists for this.
For the cronjob have a read of the docs starting at the following url:
http://ez.no/ez_publish/documentation/building_an_ez_publish_site/the_guestbook
Monday 14 March 2005 11:56:49 am
thanks -to clarify when you say "The module and cronjob/automation are entirely seperate. But both can use the same template that you can create."
Do you mean these are 2 different ways to achieve the same goal OR do I have to use both?
Im hoping I pick one method, although I dont see any reason to use a module. Ive read through the documentation you mentioned (previously and again). If I have the template already producing the desired output, I should just need to create an appropriate script correct?
thanks again