Perfect!  Just what I was looking for!

Thanks!

Eric


On Mon, Jan 10, 2011 at 12:19 AM, Gareth McCumskey <[email protected]>wrote:

> You can also create your email body as a partial and then use the
> $this->getPartial()  function to essentially run the partial and store the
> output of it in a variable:
>
> $email->setBody( $this->getPartial('myEmailPartial',
> array('partial_variable'=>$partial_variable );
>
> On Sun, Jan 9, 2011 at 11:23 PM, Eric B <[email protected]> wrote:
>
>> Hi,
>>
>> Given that Symfony is built around templates, I am trying to figure out
>> how I can leverage the power of the templates for other things, such as
>> emails.  For example, I would like to write up my email in a template form,
>> then simply pass it the necessary variables to populate it.  Finally, if I
>> could "get" the output as text, I could assign it to the body of my mail,
>> and off I go.  That would allow me to separate the contents from my action.
>>
>> I've checked the docs, but haven't found anything that really explains how
>> I could make something like this work.  For instance, I'd love to be able to
>> do somehting like:
>>
>>    // start pseudo-code
>>    $emailTemplate = new Template("myEmailTemplateName" );
>>    $emailTemplate->setVar( $user );
>>    $body = $emailTemplate->getMergedTemplate();
>>    // end psuedo-code
>>
>>     $email = Swift_Message::newInstance();
>>     $email->setFrom( "[email protected]" );
>>     $email->setTo( $user->getEmail() );
>>     $email->setSubject( "subject line" );
>>     $email->setBody( $body );
>>
>>     $this->getMailer()->send( $email );
>>
>>
>> Then in the "myEmailTemplate" I'd be able to put in whatever text I
>> wanted.
>>
>> Do I need to install another template engine plugin for something like
>> this?  Or can I use what Symfony already has?
>>
>> Thanks!
>>
>> Eric
>>
>>  --
>> If you want to report a vulnerability issue on symfony, please send it to
>> security at symfony-project.com
>>
>> You received this message because you are subscribed to the Google
>> Groups "symfony users" group.
>> To post to this group, send email to [email protected]
>> To unsubscribe from this group, send email to
>> [email protected]<symfony-users%[email protected]>
>> For more options, visit this group at
>> http://groups.google.com/group/symfony-users?hl=en
>>
>
>
>
> --
> Gareth McCumskey
> http://garethmccumskey.blogspot.com
> twitter: @garethmcc
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<symfony-users%[email protected]>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to