Try making the changes below and then running the script again. Make sure you have an email server listening on localhost.<br><br>=============start script=============<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<br>
#!/usr/bin/python<br>
<br>
import os, smtplib<br>
system_name = os.getenv('HOSTNAME')<br>
<br>
<br>
SERVER = localhost <span style="color: rgb(255, 0, 0);"><-- This should be: SERVER = "localhost"</span><br>
<br>
FROM = "<a href="mailto:me@abc.com">me@abc.com</a>"<br>
TO = ["<a href="mailto:you@nbc.com">you@nbc.com</a>"]<br>
<br>
SUBJECT = "Mail from",os.getenv('HOSTNAME') <span style="color: rgb(255, 0, 0);"><-- You've already stored this in the variable system_name, use it instead.</span><br>
<br>
TEXT = "This message is from",os.getenv('HOSTNAME') <span style="color: rgb(255, 0, 0);"><-- See above.</span><br>
<br>
message = """\<br>
From: %s<br>
To: %s<br>
Subject: %s<br>
<br>
%s<br>
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)<br>
<br>
# Send message<br>
<br>
server = smtplib.STMP(SERVER) <span style="color: rgb(255, 0, 0);"><-- Should be: server = smtplib.SMTP(SERVER)</span><br>
server.sendmail(FROM, TO, message)<br>
server.quit()<br>
<br>
=============end script=============<br></blockquote></div>-- <br>Stephen Haywood<br>Information Security Consultant<br>CISSP, GPEN, OSCP<br>T: @averagesecguy<br>W: <a href="http://averagesecurityguy.info" target="_blank">averagesecurityguy.info</a><br>
<br>