ez projects / ezsurvey_ezp4 / forum / general / mail trouble / re: mail trouble
You need to be logged in to post messages in the forums. New users may register here.
|
Member since: Posts: 5 |
Tuesday 13 January 2009 1:09:42 am Im trying to add some functions to the survey mail. My trouble are that the mail received in gmail stacks every sent survey. This is no good. I also want the mail to add the mail address and from name of the sender. Another problem is that the survey name don't add to the subject in a mail. It only says Filled Survey at the moment.
Tried several things tonight, and this is the code i am at now. {set-block scope=root variable=subject}{$node.name}{/set-block} {set-block scope=root variable=from}Paal{/set-block} {set-block scope=root variable=reply_to}paal@messenlien.com{/set-block} Have not started to extract mail information yet. Not sure why the set-block variable wont work here. Have used that in templates before. Any suggestions or help out there? -------------------------------------------- |
|
|
Member since: Posts: 39 |
Tuesday 13 January 2009 9:29:47 am I think the mail problem may be because of that the reference headers are not set in eZ Survey .. and therefore just handled by the standard eZMail classes in eZ Publish itself.
Your template code looks like a good way to solve this. So the only thing left is to receive the variables you're setting in the PHP code as well. This is done in the eZSurvey datatype itself (ezsurveytype.php). Cheers, Bjørn |
|
|
Member since: Posts: 5 |
Friday 16 January 2009 10:56:41 am Thanks, got it solved by changing the datatype file
$templateResult = $tpl_email->fetch( 'design:survey/mail.tpl' ); $subject = $tpl_email->variable( 'subject' ); $emailSender = $tpl_email->variable( 'from' ); $mail = new eZMail(); $ini = eZINI::instance(); // $emailSender = $ini->variable( 'MailSettings', 'EmailSender' ); // if ( !$emailSender ) // $emailSender = $ini->variable( 'MailSettings', 'AdminEmail' ); $mail->setSenderText( $emailSender ); $mail->setReceiver( $mailTo ); $mail->setSubject( $subject ); $mail->setBody( $templateResult ); And the mail template code {def $timestamp=currentdate()} {def $sender = = ezini( 'MailSettings', 'AdminEmail', 'site.ini' )} {set-block scope=root variable=subject}[{$timestamp|l10n( 'shortdatetime' )}-{$survey.id}]{$node.name}{/set-block} {foreach $survey_questions as $question} {switch match=$question.type} {case match='EmailEntry'} {set $sender = $question.answer} {/case} {/switch} {/foreach} {set-block scope=root variable=from}{$sender}{/set-block} {"The following information was collected as the result of the survey:"|i18n('survey')} <br> {section var=question loop=$survey_questions} {survey_question_result_gui view=mail question=$question} {/section} I have also made some template changes so the mail is being sent as html so the mail result is more understanding. Can upload it as a hack project for the extension if someone need it. -------------------------------------------- |
You need to be logged in to post messages in the forums. New users may register here.