Friday 05 March 2004 7:43:32 am
If information is submitted via an information collection object, and received by e-mail, the sender and subject of the email messages show default values. It is easy to adapt this, so the sender and subject are shown with the values filled in in the form.
To do so, you have to change the design/templates/content/collectedinfomail/form.tpl file to set the template variables (assuming you have the 'subject', 'name' and 'email' as identifiers in the class definition):
{section name=Attribute loop=$collection.attributes}
{$Attribute:item.contentclass_attribute_name|wash}:
{* Add these lines *}
{switch match=$Attribute:item.contentclass_attribute.identifier}
{case match='subject'}{set-block scope=root variable=subject}{concat($collection.object.name,': ',$Attribute:item.data_text)}{/set-block}{/case}
{case match='name'}{set-block scope=root variable=name_sender}{$Attribute:item.data_text}{/set-block}{/case}
{case match='email'}{set-block scope=root variable=email_sender}{$Attribute:item.data_text}{/set-block}{/case}
{case}{/case}
{/switch}
{* End of addition *} {attribute_result_gui view=info attribute=$Attribute:item} Next step is to change the file kernel/content/collectinformation.php:
// Around line 272
$subject =& $tpl->variable( 'subject' );
$receiver =& $tpl->variable( 'email_receiver' );
$redirectToNodeID =& $tpl->variable( 'redirect_to_node_id' );
// Add these lines
$name_receiver = & $tpl->variable( 'receiver' );
$name_sender = & $tpl->variable( 'name_sender' ); $email_sender = & $tpl->variable( 'email_sender' );
...
// Around line 295
$mail->setReceiver( $receiver );
$mail->setSubject( $subject );
$mail->setBody( $templateResult );
// Add this line $mail->setSender( $email_sender, $name_sender ); This should work fine, but the solution is not nice, as a file in the kernel has tobe changed. So, my question is: How can this be accomplished without changing this kernel file (create extension?)
|