Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #  This program is free software; you can redistribute it and/or modify
  2. #  it under the terms of the GNU General Public License as published by
  3. #  the Free Software Foundation; either version 2 of the License, or
  4. #  (at your option) any later version.
  5. #  
  6. #  This program is distributed in the hope that it will be useful,
  7. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  9. #  GNU General Public License for more details.
  10. #  
  11. #  You should have received a copy of the GNU General Public License
  12. #  along with this program; if not, write to the Free Software
  13. #  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  14. #  MA 02110-1301, USA.
  15. #
  16. #  send.py 0.1 fanta@hackingaround.net
  17. # -*- coding: utf-8 -*-
  18. import smtplib
  19. import sys
  20. from email.mime.text import MIMEText
  21.  
  22. if len(sys.argv) == 1:
  23.     print "Usage send.py [-t 'texto' -e 'nobody@email.com' -d 'Mon, 17 Feb 2015 08:42:33 +0100' -s 'asunto' -f 'from@email.com' -i '2342342342352352' -n 'nickname' -o 'status']"
  24. else:
  25.     if (sys.argv[1] == "-t" and sys.argv[3] == "-e" and sys.argv[5] == "-d" and sys.argv[7] == "-s" and sys.argv[9] == "-f" and sys.argv[11] == "-i" and sys.argv[13] == "-n" and sys.argv[15] == "-o" and len(sys.argv) == 17):
  26.         texto = sys.argv[2]
  27.         to = sys.argv[4]
  28.         fecha = sys.argv[6]
  29.         subject = sys.argv[8]
  30.         desde = sys.argv[10]
  31.         mid = sys.argv[12]
  32.         nick2 = sys.argv[14]
  33.         status = sys.argv[16]
  34.         msg = MIMEText(texto)
  35.         msg['Date'] = fecha
  36.         msg['Message-id'] = mid
  37.         msg['X-Mailer'] = nick2
  38.         msg['User-Agent'] = status
  39.         msg['Subject'] = subject
  40.         msg['From'] = desde
  41.         msg['Return-Path'] = desde
  42.         msg['Envelope-To'] = to
  43.         msg['To'] = to
  44.         mailServer = smtplib.SMTP('smtp.openmailbox.org',587)
  45.         mailServer.ehlo()
  46.         mailServer.starttls()
  47.         mailServer.ehlo()
  48.         mailServer.login("cuenta@openmailbox.org","password")
  49.         mailServer.sendmail(desde, to, msg.as_string())
  50.         mailServer.close()
  51.     else:
  52.         print "Usage send.py [-t 'texto' -e 'nobody@email.com' -d 'Mon, 17 Feb 2015 08:42:33 +0100' -s 'asunto' -f 'from@email.com' -i '2342342342352352' -n 'nickname' -o 'status']"