Aug 23rd, 2009, 11:03 PM
Hi, Ben,
thank you for your message. My idea was straight (and naive) it is time to start respecting the reality :-))
Let me summarize my final way: "How to send a personalized email attachment".
Maybe can be useful to somebody, not great, but works, any improvements are welcomed.
1/ Use Pre-Parsel module to generate your attachment (an invoice in my case).
2/ Save the file to disc, the is no way how to save it to database.
3/ You have to use general name of the file, e.g. "Invoice.pdf" not unique one, as {$attachment} command does not accept placeholder to specify the name of the attachment.
4/ If no attachment should be generated for the current form, delete older file from disc (if exists).
5/ Use placeholders to personalize your message you like, e.g.:
{if $ANSWER_send_attachment == "Yes"}
Please find enclosed invoice.
{/if}
6/ Use direct command {$attachment file="invoice.pdf"} to send the attachment.
You cannot use any "if statements" as file attachments won't work within other Smarty logic. If no file "invoice.pdf" exists, no attachment is sent, no error message.
----
Pretty dirty white men's trick, uh?
This works, but not tested in real yet, theoretically, I am afraid if I receive two or more form applications at the very same time, one could delete prepared saved file attachment BEFORE this can be emailed by other process.
Please, Ben, if you find some extra time, add using placeholders in "$attachment file" command. Using unique names of attachments will make this process much less complicated.
thank you for your message. My idea was straight (and naive) it is time to start respecting the reality :-))
Let me summarize my final way: "How to send a personalized email attachment".
Maybe can be useful to somebody, not great, but works, any improvements are welcomed.
1/ Use Pre-Parsel module to generate your attachment (an invoice in my case).
2/ Save the file to disc, the is no way how to save it to database.
3/ You have to use general name of the file, e.g. "Invoice.pdf" not unique one, as {$attachment} command does not accept placeholder to specify the name of the attachment.
4/ If no attachment should be generated for the current form, delete older file from disc (if exists).
5/ Use placeholders to personalize your message you like, e.g.:
{if $ANSWER_send_attachment == "Yes"}
Please find enclosed invoice.
{/if}
6/ Use direct command {$attachment file="invoice.pdf"} to send the attachment.
You cannot use any "if statements" as file attachments won't work within other Smarty logic. If no file "invoice.pdf" exists, no attachment is sent, no error message.
----
Pretty dirty white men's trick, uh?
This works, but not tested in real yet, theoretically, I am afraid if I receive two or more form applications at the very same time, one could delete prepared saved file attachment BEFORE this can be emailed by other process.
Please, Ben, if you find some extra time, add using placeholders in "$attachment file" command. Using unique names of attachments will make this process much less complicated.