The following warnings occurred: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Warning [2] Undefined array key "avatartype" - Line: 783 - File: global.php PHP 8.1.31 (Linux)
|
![]() |
Email attachments: Can I conditionally included them? - Printable Version +- Form Tools (https://forums.formtools.org) +-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1) +--- Forum: General Discussion (https://forums.formtools.org/forumdisplay.php?fid=5) +--- Thread: Email attachments: Can I conditionally included them? (/showthread.php?tid=1282) |
Email attachments: Can I conditionally included them? - russellfeeed - May 10th, 2011 Hi I'm trying to include attachments depending on the value of a form field, like so Code: {if $ANSWER_onf_network=='O2'} But my {if} smarty statement seems to be being ignored and the attachment is included anyway. Any ideas? Cheers Russell RE: Email attachments: Can I conditionally included them? - crunchers - May 10th, 2011 Not too sure on Smarty, but try removing the curly brackets between lines 2 and 3 and terminate each line with a semi-colon instead: PHP Code: {if $ANSWER_onf_network=='O2'} RE: Email attachments: Can I conditionally included them? - Ben - May 16th, 2011 Hey Russell, Actually, I don't believe so... excellent question, though. The email attachment option for the Swift Mailer module was kind of grafted on. It doesn't get parsed properly within Smarty: the code just parses the email template content for that particular string, then appends the appropriate file. So the Smarty if statement won't be acknowledged. I forget the reason why I did it this way: there was a good reason at the time, since it's clearly crumby. I'll definitely have to revisit this. - Ben RE: Email attachments: Can I conditionally included them? - russellfeeed - May 16th, 2011 Thanks @crunchers - I've not tried it yet but will reply when I do. Thanks @Ben - In other projects I've managed this using a View and Filter. I can't do this for this project unfortunately. Let me know if you need help with looking at this. RE: Email attachments: Can I conditionally included them? - zoltandragon - Sep 17th, 2012 Hi, I have a problem with attaching ANY file whatsoever with my autoresponders: SwiftMailer (1.1.2) is enabled, smtp works like a charm, Core is 2.2.5, I copy then modify the code for the enabled email templates, test it - the email arrives with all the needed data fields, but no attachment comes along. What is wrong - can anyone help me out on this? (Sorry if this thread is not appropriate for such a question - I did not want to start a new one, but will, if that is more acceptable) RE: Email attachments: Can I conditionally included them? - lobaluna - May 21st, 2016 I used double quotes for comparison, and smarty {if} statement works well: Code: {if $ANSWER_onf_network=="O2"} |