Hello, I found myself having a need to send mail with the ability to customize stuff like disposition, name, filename, encoding, etc. I modified the MIMETag to allow the use of type_expr, disposition_expr, encode_expr, name_expr, filename_expr, and skip_expr attributes in the mime and boundary tags. * type_expr, disposition_expr, encode_expr, and name_expr work like type, disposition, encode and name, except that they take expressions instead of names. * filename_expr allows to give the filename of the attachment. Note that the filename attribute is included only if the disposition attribute is set, and that in the header, the filename attribute is attached to the Content-Disposition: header, just like the name attribute is attached to the Content-Type: header. I don't know if it is ok, but it seems to be the way Netscape Messenger and Microsoft Outlook do it. * skip_expr allows to skip an attachment if the skip_expr evaluates to true. Here is an example. document is a FileUpload object. <dtml-sendmail mailhost=MailHost> to: you@anywhere.com from: me@nowhere.com subject: this is the subject <dtml-mime type=text/plain> Thanks for you input. <dtml-if "document.filename"> The file you attached is <dtml-var "document.filename"> <dtml-else> You did not attach any file </dtml-if> <dtml-boundary disposition=attachment filename_expr="document.filename" name_expr="document.filename" skip_expr="not document.filename" type_expr="document.headers['Content-Type']" encode=base64><dtml-var "document.read()"></dtml-mime> </dtml-sendmail> Please send me any comment on this work. Regards, Jephte CLAIN minf7@educ.univ-reunion.fr PS: répondez sur minf7@educ.univ-reunion.fr, et pas sur ava@dde974.equipement.gouv.fr
participants (1)
-
Ava