Recent Posts
Lua | 12 sec ago
None | 22 sec ago
None | 29 sec ago
C | 34 sec ago
Lua | 43 sec ago
C | 49 sec ago
PHP | 54 sec ago
None | 55 sec ago
Lua | 56 sec ago
None | 1 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By goobsoft on the 19th of Oct 2008 04:18:46 PM Download | Raw | Embed | Report
  1. # Upload Images to SmugMug
  2.  
  3. import smtplib
  4. import os
  5. import sys
  6. from email.MIMEMultipart import MIMEMultipart
  7. from email.MIMEText import MIMEText
  8. from email.MIMEImage import MIMEImage
  9.  
  10.  
  11. for root, dirs, files in os.walk('.'):
  12.     for filename in files:
  13.         msg = MIMEMultipart()
  14.         msg['From'] = 'accout@gmail.com'
  15.         msg['To'] = 'user@email.smugmug.com'
  16.         msg['Subject'] = 'password'
  17.        
  18.         attach = MIMEImage(file(os.path.join(root, filename)).read())
  19.         # SmugMug Requires a fileName
  20.         attach.add_header('Content-Disposition', 'attachment', filename=filename)
  21.         msg.attach(attach)
  22.        
  23.         print "Sending %s." % filename,
  24.        
  25.         server = smtplib.SMTP('email.smugmug.com')
  26.         #server.set_debuglevel(1)
  27.  
  28.         # Must use as_string for it to work right
  29.         server.sendmail("account@gmail.com", "user@email.smugmug.com", msg.as_string())
  30.         server.quit()
  31.        
  32.         print "Sent"
  33.         #sys.exit(1)
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: