[Zope] send email using python script

complaw@hal-pc.org complaw@hal-pc.org
Thu, 9 Aug 2001 21:50:53 GMT


> I have this python script, from www.zopelabs.com, I've called this script
> mail, then I have a dtml form which takes different variables from the user,
> like their email, name, checkbox and codes in the enquire_dtml.
> 
> How do I pass these variables through to the mail python script?

In your python script form, there is an edit box called "Parameters List." 
Simply list your parameters (e.g., fromname, email, etc.) in that edit box.

Thats it.


> 
> What are the performance issues of using the same form, but instead of using
> python script to use the <dtml-sendmail> tag?

I would suspect that the python script is faster, but don't quote me on that.

Cheers,

Ron

> 
> ###################################################
> try:
>     mailhost=getattr(context, context.superValues('Mail Host')[0].id)
> except:
>     raise AttributeError, "cant find a Mail Host object"
> 
> mMsg = 'a testful email message \n that contains a few line breaks. \n
> ~runyaga'
> mTo = 'runyaga@abc.com'
> mFrom = 'runyaga@xyz.com'
> mSubj = 'mail subject'
> 
> mailhost.send(mMsg, mTo, mFrom, mSubj)
> ###############################
> 
> 
> enqire_dtml
> 
> <form action="mail" method="POST">
> 
> <table border="0">
>     <tr bgcolor="#6633CC" align="center">
>       <td width="15%" align="center">
>         <div align="left"><font color='white'><strong>Issue
> Date:</strong></font></div>
>       </td>
>       <td colspan="3" width="428">
>         <div align="left"><font color='white'>
>           <select name="select">
>             <option value="May 2001">May2001</option>
>             <option value="June 2001">June 2001</option>
>             <option value="July / August 2001">August 2001</option>
>             <option value="September 2001">September2001</option>
>           </select>
>           </font></div>
>       </td>
>     </tr>
>     <tr bgcolor="#FFFFCC">
>       <td width="87" align="center">
>         <div align="left"><strong>From:</strong></div>
>       </td>
>       <td colspan="3" width="428">
>         <table>
>           <tr>
>             <td>Name:</td>
>             <td>
>               <input name="fromname" value="<dtml-var "member.first_name"
> html_quote> <dtml-var "member.last_name" html_quote>">
>             </td>
>             <td>Email:</td>
>             <td>
>               <input name="email"
>                 value="<dtml-var "member.email" html_quote>">
>             </td>
>           </tr>
> 
>         </table>
>       </td>
>     </tr>
>     <tr>
>       <td colspan="4" align="center">
>         <p><strong>Enquiry Numbers</strong> <br>
>           <input type="text" name="description:text" size="5" value=""
> maxlength="3">
>           <input type="text" name="description:text2" size="5" value=""
> maxlength="3">
> 
>       </td>
>     </tr>
>     <tr bgcolor="#FFFFCC">
>       <td width="87" align="center">
>         <div align="center">
>           <input type="checkbox"
>                          name="confidential:boolean"
>                          value="0" checked>
>         </div>
>       </td>
>       <td colspan="3" width="428"><strong><font size="1">Tick
> box</font></strong>
>       </td>
>     </tr>
>     <tr bgcolor="#CCFF99">
>       <td width="87" align="center">  </td>
>       <td colspan="3" width="428"> </td>
>     </tr>
>   </table>
> 
> <br>
> 
> <input type="submit" name="submitissue" value="   Send   "
> class="submitbutton">
> 
> </form>
> 
> zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
> zz/********/z/****\zzz|****\*\zz|*******|z
> z/^^^^^^^^/z/******\zz|*^^^^|*|z|*|^^^^^|z norman khine
> zzzzzz/**/z|**/^^\**|z|*|zzz|*|z|*|zzzzzzz mailto:norman@khine.net
> zzzzz/**/zz|*|zzzz|*|z|****/*/zz|*****|zzz purley
> z/******/zz|*|zzzz|*|z|*|^^zzzzz|*|^^^|zzz UK
> zzZ/**/zzzz|**\^^/**|z|*|zzzzzzz|*|zzzzzzz
> zz/******/zz\******/zz|*|zzzzzzz|*|*****|z
> z/^^^^^^/zzzz\^^^^/zzz|^|zzzzzzz|^^^^^^^|z
> zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
> 
> 
> 
> _______________________________________________
> 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 )
>