2010-08-03 127 views

回答

4

要发送附件,您必须填写包含文件名和文件内容的二值元组列表的电子邮件附件字段。来自here

from google.appengine.api import urlfetch 
from google.appengine.api import mail 

url = "http://www.abc.com/files/file.pdf" 
result = urlfetch.fetch(url) 

if result.status_code == 200: 
    document = result.content 

mail.send_mail(sender="[email protected]", 
       to="[email protected]", 
       subject="The file you wanted", 
       body="Here is the file you wanted", 
       attachments=[("The file name.pdf", document)]) 
+0

谢谢!完美地工作! – demos 2010-08-03 18:06:05