Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Send email button


Reply


2 Posts   1093 Views

Avatar
Mo

Community Member, 514 Posts

28 August 2009 at 9:48pm

Hi All,

Couple of quick questions. I would like to add a send email button for certain templates in the CMS. How would I go about doing this, and adding recipients for that email? I have looked at http://doc.silverstripe.org/doku.php?id=email but it doesn't really g into that sort of detail.

Also, how could I send images linked to that page via a $has_one as attachments? Can I literally do a Dataobject::get() and load the result into a parameter?

Cheers in advance,

Mo

Avatar
MarcusDalgren

Community Member, 288 Posts

29 August 2009 at 2:21am

Edited: 29/08/2009 2:23am

You should be able to do this with one or more custom email templates.
Link the button to an action on your controller that sets up the template and the email.

You can send custom variables to the template so I think you can get an image in that way.
Use $email->populateTemplate(Your stuff here); to send the content you want to the email template.