# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
# send.py 0.1 fanta@hackingaround.net
# -*- coding: utf-8 -*-
import smtplib
import sys
from email.mime.text import MIMEText
if len(sys.argv) == 1:
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']"
else:
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):
texto = sys.argv[2]
to = sys.argv[4]
fecha = sys.argv[6]
subject = sys.argv[8]
desde = sys.argv[10]
mid = sys.argv[12]
nick2 = sys.argv[14]
status = sys.argv[16]
msg = MIMEText(texto)
msg['Date'] = fecha
msg['Message-id'] = mid
msg['X-Mailer'] = nick2
msg['User-Agent'] = status
msg['Subject'] = subject
msg['From'] = desde
msg['Return-Path'] = desde
msg['Envelope-To'] = to
msg['To'] = to
mailServer = smtplib.SMTP('smtp.openmailbox.org',587)
mailServer.ehlo()
mailServer.starttls()
mailServer.ehlo()
mailServer.login("cuenta@openmailbox.org","password")
mailServer.sendmail(desde, to, msg.as_string())
mailServer.close()
else:
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']"