#!/usr/bin/python

import smtplib

fromaddr = "From: ipfire01@ipfire.org"
toaddrs = "To: entwickler@ipfire.org"
#password = "<password>"

msg = ""
subject = ""
header = ""
body = ""

while 1:
	try:
		line = raw_input()
	except EOFError:
		break
	if line.startswith("From: "):
		fromaddr = line
	elif line.startswith("To: "):
		toaddrs = line
	elif line.startswith("Subject: "):
		subject = line
	else:
		body = body + line + "\r\n"

for i in fromaddr, toaddrs, subject:
	header = header + i + "\r\n"
	
msg = header + "\r\n" + body # An empty line to finish the header + add the body

server = smtplib.SMTP('mail01.tremer.info')
#server.set_debuglevel(1)
#server.login(fromaddr, password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()
