pastebin - collaborative debugging

pastebin is a collaborative debugging tool allowing you to share and modify code snippets while chatting on IRC, IM or a message board.

This site is developed to XHTML and CSS2 W3C standards. If you see this paragraph, your browser does not support those standards and you need to upgrade. Visit WaSP for a variety of options.

linuxcrazy private pastebin - collaborative debugging tool What's a private pastebin?


Posted by comprookie2000 on Sun 7 Jun 00:09
report abuse | download | new post

  1. #!/usr/bin/python
  2. from time import sleep
  3. import smtplib
  4. import os
  5. from email.MIMEMultipart import MIMEMultipart
  6. from email.MIMEBase import MIMEBase
  7. from email.MIMEText import MIMEText
  8. from email.Utils import COMMASPACE, formatdate
  9. from email import Encoders
  10.  
  11. def send_mail(send_to, subject, text, files=[],
  12.               server="mail.yourserver.net"):
  13.     assert type(send_to)==list
  14.     assert type(files)==list
  15.     send_from = "Grateful User <user@grateful.net>"
  16.  
  17.     msg = MIMEMultipart()
  18.     msg['From'] = send_from
  19.     msg['To'] = COMMASPACE.join(send_to)
  20.     msg['Date'] = formatdate(localtime=True)
  21.     msg['Subject'] = subject
  22.  
  23.     msg.attach( MIMEText(text) )
  24.  
  25.     for f in files:
  26.         part = MIMEBase('application', "octet-stream")
  27.         part.set_payload( open(f,"rb").read() )
  28.         Encoders.encode_base64(part)
  29.         part.add_header(
  30.             'Content-Disposition', 'attachment; filename="%s"' % os.path.basename(f))
  31.         msg.attach(part)
  32.  
  33.     smtp = smtplib.SMTP(server)
  34.     smtp.sendmail(send_from, send_to, msg.as_string())
  35.     smtp.close()
  36.  
  37. def message(address):
  38.     body = "Just a short note to say thank you for all the time and work you put into Gentoo.\n user aka (gentoo_guru)\n\n http://linux.com"
  39.     send_mail(
  40.         [address],
  41.         "Thanks", body)
  42.  
  43. def send_message():
  44.     all_addresses = ['dev1@gentoo.com', 'dev2@gentoo.com']
  45.     for address in all_addresses:
  46.         message(address)
  47.  
  48. send_message()

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with @@


Remember me so that I can delete my post