0

Help please! I need to post some text data to an e-mail adress or web site form using s4la python how can i do that(without opening e-mail client)?

Just to be clear: This will be a "webshop tool" that reads info from a qr code and sent it to the webshop. Just read a code and read an "ordered amount" and send them.

why python? Becouse thats the only one i can use. :)

2 Answers 2

1

To send your data to a website, look at the file weather.py This file is provided as example when you install python.

http://code.google.com/p/android-scripting/source/browse/python/ase/scripts/weather.py

it uses the module urllib2

interesting part of the file:

WEATHER_URL = 'http://www.google.com/ig/api?weather=%s&hl=%s'
url = WEATHER_URL % (urllib.quote(location), hl)
handler = urllib2.urlopen(url)
data = handler.read()
Sign up to request clarification or add additional context in comments.

Comments

0

You can use smtplib if you want to connect to an SMTP server like Google.

To send use:

msg = MIMEMultipart()
msg['Subject'] = 'Our Subject'
msg['To'] = '[email protected]'
msg['From'] = '[email protected]'
msg.attach(MIMEText(body, 'plain'))

smtpObj = smtplib.SMTP(smtp_server,smtp_port)
smtpObj.starttls()
smtpObj.ehlo()
smtpObj.login(username,password)

smtpObj.sendmail(username,to_addr,msg.as_string())
smtpObj.close()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.