]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - tools/sendEmail
Updated asterisk package.
[people/pmueller/ipfire-2.x.git] / tools / sendEmail
1 #!/usr/bin/python
2
3 import smtplib
4
5 fromaddr = "From: ipfire01@ipfire.org"
6 toaddrs = "To: entwickler@ipfire.org"
7 #password = "<password>"
8
9 msg = ""
10 subject = ""
11 header = ""
12 body = ""
13
14 while 1:
15 try:
16 line = raw_input()
17 except EOFError:
18 break
19 if line.startswith("From: "):
20 fromaddr = line
21 elif line.startswith("To: "):
22 toaddrs = line
23 elif line.startswith("Subject: "):
24 subject = line
25 else:
26 body = body + line + "\r\n"
27
28 for i in fromaddr, toaddrs, subject:
29 header = header + i + "\r\n"
30
31 msg = header + "\r\n" + body # An empty line to finish the header + add the body
32
33 server = smtplib.SMTP('mail01.tremer.info')
34 #server.set_debuglevel(1)
35 #server.login(fromaddr, password)
36 server.sendmail(fromaddr, toaddrs, msg)
37 server.quit()