Hi (again); Okay, in DTML, when one calls a Formulator form via a DTML document, the DTML document to which one sends the POST is able to render variables from the form thus: <dtml-var my_variable_from_the_form> Now, I'm trying to do this via a Python script (which I promise I will furnish for other dummies like me via a HowTo): form = context.email_us_formulator i = 0 myField = [] for field in form.get_fields(): myField.append(field.get_value('title')) WHAT DO I DO HERE?? i = i + 1 try: mailhost=getattr(context, context.superValues('Mail Host')[0].id) except: raise AttributeError, "cant find a Mail Host object" mTo = 'beno@thewebsons.com' mFrom = YourEmail mSubj = 'subject' message = "Hi, Mike! You've just been sent an email from your Web site!\n\n" message += "Sender's name: " + YourName + "\n" message += "Sender's phone: " + YourPhone + "\n" message += "Sender's email: " + YourEmail + "\n\n" message += "Sender's comments: " + YourMessage + "\n" mMsg = message mailhost.send(mMsg, mto=mTo, mfrom=mFrom, subject=mSubj) where the *WHAT DO I DO HERE??* needs to call the values from the form. (I may be mistaken with the line above that, too.) Can you help me? TIA, beno
At 01:49 PM 11/5/2002 -0400, beno wrote:
message = "Hi, Mike! You've just been sent an email from your Web site!\n\n" message += "Sender's name: " + YourName + "\n" message += "Sender's phone: " + YourPhone + "\n" message += "Sender's email: " + YourEmail + "\n\n" message += "Sender's comments: " + YourMessage + "\n" mMsg = message
Somewhat unrelated, but hopefully helpful: The quoted code snippet will work quite a bit more efficiently as: message = [] message.append("Hi, Mike! You've just been sent an email from your Web site!\n") message.append("Sender's name: %s" % YourName) ... mMsg = '\n'.join(message) If you aren't sending out a lot of these, it may not make much difference in this specific case, but making a habit of using %s and append/join to concatenate strings instead of + and += is well worth your while. FWIW, Dylan
At 10:08 AM 11/5/2002 -0800, you wrote:
At 01:49 PM 11/5/2002 -0400, beno wrote:
message = "Hi, Mike! You've just been sent an email from your Web site!\n\n" message += "Sender's name: " + YourName + "\n" message += "Sender's phone: " + YourPhone + "\n" message += "Sender's email: " + YourEmail + "\n\n" message += "Sender's comments: " + YourMessage + "\n" mMsg = message
Somewhat unrelated, but hopefully helpful:
The quoted code snippet will work quite a bit more efficiently as:
message = [] message.append("Hi, Mike! You've just been sent an email from your Web site!\n") message.append("Sender's name: %s" % YourName) ... mMsg = '\n'.join(message)
If you aren't sending out a lot of these, it may not make much difference in this specific case, but making a habit of using %s and append/join to concatenate strings instead of + and += is well worth your while.
Thank you! beno
participants (2)
-
beno -
Dylan Reinhardt