I am battling to find the information needed to attach word, excel, and pdf documents to an email based on the input from a form. I know that there is a howto that uses a python method, but I do not want to use this option. Where can I get the necessary mime types and structure to accomplish this? This is what I have so far: <!--#sendmail mailhost="MailHost"--> To: <dtml-var Email_address> From: WebForm <Webmaster@mysite.com> Subject: Web doc request <dtml-mime type=text/plain encode=7bit> Attached is the document you requested. <dtml-boundary type=application/<dtml-var Doc_Type> disposition=attachment encode=quoted-printable> <dtml-var <dtml-var Requested_Document>> </dtml-mime> <!--#/sendmail--> Thanks Brendon ------------------ 70South: the No.1 source for Antarcticles. For the latest news and views on Antarctica visit : http://www.70south.com
Brendon Grunewald wrote:
I am battling to find the information needed to attach word, excel, and pdf documents to an email based on the input from a form.
This is what I have so far:
I do wish you'd move to the new syntax style :P
<!--#sendmail mailhost="MailHost"--> To: <dtml-var Email_address> From: WebForm <Webmaster@mysite.com> Subject: Web doc request <dtml-mime type=text/plain encode=7bit> Attached is the document you requested.
looks fine...
<dtml-boundary type=application/<dtml-var Doc_Type> disposition=attachment encode=quoted-printable> <dtml-var <dtml-var Requested_Document>> </dtml-mime>
My bit of the above is a bit different: <dtml-boundary name="the_file_name" type=application/octet-stream disposition=attachment encode=base64><dtml-var "a_file_object.read()"></dtml-mime> Which might make all the difference ;-) cheers, Chris PS The above works for me on Zope 2.1.6...
Hi Chris, This is what I have in total. I know I am being stupid, but this is frustrating me to hell. Perhaps I should not be doing this at 1AM. The form looks like this: -------- <dtml-var standard_html_header> <form METHOD="POST" ACTION="send_webdoc"> Please provide the following information: <br> <br> Email address: <input TYPE="TEXT" NAME="Email_address" SIZE="20"> <br> Document: <SELECT NAME="Required_Doc"> <OPTION>Brochure.doc</OPTION> <OPTION>Pricelist.xls</OPTION> <OPTION>Map.pdf</OPTION> </SELECT> <br> <p><input TYPE="submit" VALUE="Send Form"> <input TYPE="RESET" VALUE="Reset Form"> </p> </form> <dtml-var standard_html_footer> --------- send_webdoc looks like this... ------- <html> <head> <TITLE><!--#var title_or_id--></TITLE> <meta http-equiv="Refresh" content="5; url=<!--#var Redirect_URL-->"> </head> <BODY <!--#var BackgroundImage -->> <dtml-sendmail mailhost="MailHost"> To: <dtml-var Email_address> From: WebForm <Webmaster@70south.com> Subject: Web Doc Request <dtml-mime type=text/plain encode=7bit> Attached is the document you requested: <dtml-var Required_Doc> <dtml-boundary name="<dtml-var Required_Doc" type=application/octet-stream disposition=attachment encode=base64> <dtml-var "Required_Doc.read()"> </dtml-mime> </dtml-sendmail> <H2>Form Information Confirmation</H2> Thank you the document should be email to you immediately.<BR> You should be automatically redirected in a few seconds.<BR> <p> If not <a href="<!--#var Redirect_URL-->">Click here</a>. </p> <dtml-var standard_html_footer> ------ Thanks Brendon ------------------ 70South: the No.1 source for Antarcticles. For the latest news and views on Antarctica visit : http://www.70south.com
Brendon Grunewald wrote:
The form looks like this: <snip form>
That looks okay...
<meta http-equiv="Refresh" content="5; url=<!--#var Redirect_URL-->">
could you just use: <dtml-call "RESPONSE.redirect(Redirect_URL)"> somewhere on the page instead of the meta-refresh nastiness?
Attached is the document you requested: <dtml-var Required_Doc>
I do hope Required_Doc is a string or a function returning a strign and not the actual document ;-)
<dtml-boundary name="<dtml-var Required_Doc" type=application/octet-stream ^^^^^^^^^^^^^^^^^^^^^^^ Oops, DTML-inside-DTML error ;-)
...and a major falling down of the sendmail tag, this should be expressionable, I don't know if there is somethign to solve this yet...
disposition=attachment encode=base64>
<dtml-var "Required_Doc.read()"> </dtml-mime>
what is Required_Doc? cheers, Chris
Required_Doc is the variable set in the form. (see my previous email for details onthe form). Basically I want the following functionality: 1. Enter email address: 2. Select document of file to be emailed. 3. Click Send and Bang, off it goes! Brendon ----- Original Message ----- From: "Chris Withers" <chrisw@nipltd.com> To: "Brendon Grunewald" <brendon@70south.com> Cc: <zope@zope.org> Sent: Thursday, 31 August, 2000 14:22 Subject: Re: File Attachments with Sendmail
Brendon Grunewald wrote:
The form looks like this: <snip form>
That looks okay...
<meta http-equiv="Refresh" content="5; url=<!--#var Redirect_URL-->">
could you just use: <dtml-call "RESPONSE.redirect(Redirect_URL)"> somewhere on the page instead of the meta-refresh nastiness?
Attached is the document you requested: <dtml-var Required_Doc>
I do hope Required_Doc is a string or a function returning a strign and not the actual document ;-)
<dtml-boundary name="<dtml-var Required_Doc" type=application/octet-stream ^^^^^^^^^^^^^^^^^^^^^^^ Oops, DTML-inside-DTML error ;-)
...and a major falling down of the sendmail tag, this should be expressionable, I don't know if there is somethign to solve this yet...
disposition=attachment encode=base64>
<dtml-var "Required_Doc.read()"> </dtml-mime>
what is Required_Doc?
cheers,
Chris
Great answer, but I have one question: <dtml-boundary name="<dtml-var Required_Doc" type=application/octet-stream disposition=attachment encode=base64> does not expand the Required_Doc name, do anyone know why?? ----- Original Message ----- From: "Brendon Grunewald" <brendon@70south.com> To: "Chris Withers" <chrisw@nipltd.com> Cc: <zope@zope.org> Sent: Thursday, August 31, 2000 5:12 AM Subject: [Zope] Re: File Attachments with Sendmail
Hi Chris,
This is what I have in total. I know I am being stupid, but this is frustrating me to hell. Perhaps I should not be doing this at 1AM.
The form looks like this: -------- <dtml-var standard_html_header> <form METHOD="POST" ACTION="send_webdoc"> Please provide the following information: <br> <br> Email address: <input TYPE="TEXT" NAME="Email_address" SIZE="20"> <br> Document: <SELECT NAME="Required_Doc"> <OPTION>Brochure.doc</OPTION> <OPTION>Pricelist.xls</OPTION> <OPTION>Map.pdf</OPTION> </SELECT> <br> <p><input TYPE="submit" VALUE="Send Form"> <input TYPE="RESET" VALUE="Reset Form"> </p> </form> <dtml-var standard_html_footer> ---------
send_webdoc looks like this... ------- <html> <head> <TITLE><!--#var title_or_id--></TITLE> <meta http-equiv="Refresh" content="5; url=<!--#var Redirect_URL-->"> </head> <BODY <!--#var BackgroundImage -->>
<dtml-sendmail mailhost="MailHost"> To: <dtml-var Email_address> From: WebForm <Webmaster@70south.com> Subject: Web Doc Request <dtml-mime type=text/plain encode=7bit> Attached is the document you requested: <dtml-var Required_Doc> <dtml-boundary name="<dtml-var Required_Doc" type=application/octet-stream disposition=attachment encode=base64> <dtml-var "Required_Doc.read()"> </dtml-mime> </dtml-sendmail>
<H2>Form Information Confirmation</H2> Thank you the document should be email to you immediately.<BR> You should be automatically redirected in a few seconds.<BR> <p> If not <a href="<!--#var Redirect_URL-->">Click here</a>. </p> <dtml-var standard_html_footer> ------
Thanks Brendon
------------------ 70South: the No.1 source for Antarcticles. For the latest news and views on Antarctica visit : http://www.70south.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
Luis Cortes wrote:
Great answer, but I have one question:
<dtml-boundary name="<dtml-var Required_Doc" type=application/octet-stream disposition=attachment encode=base64>
does not expand the Required_Doc name, do anyone know why??
Urm... read me previous post in this thread?! Chris
Dear Luis, Dieter Mauer was kind enough to assist me with the answer to this question. The normal Sendmail tag does not accept variables. You need to install the MIME.py.patch. Once that is done you can include variables. Brendon ----- Original Message ----- From: "Luis Cortes" <LCortes@IMEME.NET> To: "Brendon Grunewald" <brendon@70south.com> Cc: "Zope mailing list" <Zope@zope.org> Sent: Monday, 04 September, 2000 10:03 Subject: Re: [Zope] Re: File Attachments with Sendmail
Great answer, but I have one question:
<dtml-boundary name="<dtml-var Required_Doc" type=application/octet-stream disposition=attachment encode=base64>
does not expand the Required_Doc name, do anyone know why??
----- Original Message ----- From: "Brendon Grunewald" <brendon@70south.com> To: "Chris Withers" <chrisw@nipltd.com> Cc: <zope@zope.org> Sent: Thursday, August 31, 2000 5:12 AM Subject: [Zope] Re: File Attachments with Sendmail
Hi Chris,
This is what I have in total. I know I am being stupid, but this is frustrating me to hell. Perhaps I should not be doing this at 1AM.
The form looks like this: -------- <dtml-var standard_html_header> <form METHOD="POST" ACTION="send_webdoc"> Please provide the following information: <br> <br> Email address: <input TYPE="TEXT" NAME="Email_address" SIZE="20"> <br> Document: <SELECT NAME="Required_Doc"> <OPTION>Brochure.doc</OPTION> <OPTION>Pricelist.xls</OPTION> <OPTION>Map.pdf</OPTION> </SELECT> <br> <p><input TYPE="submit" VALUE="Send Form"> <input TYPE="RESET" VALUE="Reset Form"> </p> </form> <dtml-var standard_html_footer> ---------
send_webdoc looks like this... ------- <html> <head> <TITLE><!--#var title_or_id--></TITLE> <meta http-equiv="Refresh" content="5; url=<!--#var Redirect_URL-->"> </head> <BODY <!--#var BackgroundImage -->>
<dtml-sendmail mailhost="MailHost"> To: <dtml-var Email_address> From: WebForm <Webmaster@70south.com> Subject: Web Doc Request <dtml-mime type=text/plain encode=7bit> Attached is the document you requested: <dtml-var Required_Doc> <dtml-boundary name="<dtml-var Required_Doc" type=application/octet-stream disposition=attachment encode=base64> <dtml-var "Required_Doc.read()"> </dtml-mime> </dtml-sendmail>
<H2>Form Information Confirmation</H2> Thank you the document should be email to you immediately.<BR> You should be automatically redirected in a few seconds.<BR> <p> If not <a href="<!--#var Redirect_URL-->">Click here</a>. </p> <dtml-var standard_html_footer> ------
Thanks Brendon
------------------ 70South: the No.1 source for Antarcticles. For the latest news and views on Antarctica visit : http://www.70south.com
_______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
participants (4)
-
Bob Crosley -
Brendon Grunewald -
Chris Withers -
Luis Cortes