Files
bpfire/tools/sendEmail
2007-08-29 18:52:21 +00:00

40 lines
765 B
Python
Executable File

#!/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 not line:
# 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.ipfire.org')
#server.set_debuglevel(1)
#server.login(fromaddr, password)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()