Sending an Email with Form Data via Mailgun and Python -


i understand basics of sending message via mailgun api using python , requests site , works fine. attach data html form using request.forms.get(''), can't figure out syntax make work. link below need do, except in python instead of php.

http://www.formget.com/mailgun-send-email/

how can send following form data example through via mailgun?

html form (parts of point across)

<form action="/send" method="post"> <input name="name" placeholder="name"> ... <button> ... 

route (parts of point across)

@route('/send', method='post') def send_simple_message(): variable_i_need_to_send = request.forms.get('firstname') ... data={...",         "to": "myname <myname@gmail.com>",         "subject": "website info request",         "text": "testing mailgun awesomness!",         "html": **variable_i_need_to_send**})     return ''' 

thank you

you can use requests library:

import requests  @route('/send/<firstname>', method='post') def send_simple_message(first_name):     ...     data={...",             "from": "{} <address>".format(first_name),             "to": "myname <myname@gmail.com>",             "subject": "website info request",             "text": "testing mailgun awesomness!",             "html": '**i need include form data here**'})      requests.post('http://api_url/', data=data)     return  

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -