2010-08-03 124 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