Attaching Files to Email in App Engine? -
How do I add files located on a web url in an email using Google App Engine (Python)?
I have a file that says:
I want to add it to the email and send it to a user on the app engine. How do i do this
To send the attachment, you must fill the attachment area of an email message with two filenames and file content Google.appengine.api import urlfetch from google.appengine.api import mail url = "http://www.abc.com/files/file.pdf" results = urlfetch from
< From pre> Get (url) if result.status_code == 200: document = result.content mail.send_mail (sender = "youremail@yourdomain.com", to = "receiver@hisdomain.com", subject = "the file you wanted ", Body =" here is the file you have found ", attachment = [(" file name .pdf ", document)])
Comments
Post a Comment