[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ale] Need help with a Python Script
- Subject: [ale] Need help with a Python Script
- From: stephen at averagesecurityguy.info (Stephen Haywood)
- Date: Thu, 17 Nov 2011 22:30:19 -0500
- In-reply-to: <CAPfJb3rVMf=FErPNEqdvF95bd67G_OUnT7htB_8tOv2_9XCfXw@mail.gmail.com>
- References: <CAPfJb3rVMf=FErPNEqdvF95bd67G_OUnT7htB_8tOv2_9XCfXw@mail.gmail.com>
Try making the changes below and then running the script again. Make sure
you have an email server listening on localhost.
=============start script=============
>
> #!/usr/bin/python
>
> import os, smtplib
> system_name = os.getenv('HOSTNAME')
>
>
> SERVER = localhost <-- This should be: SERVER = "localhost"
>
> FROM = "me at abc.com"
> TO = ["you at nbc.com"]
>
> SUBJECT = "Mail from",os.getenv('HOSTNAME') <-- You've already stored
> this in the variable system_name, use it instead.
>
> TEXT = "This message is from",os.getenv('HOSTNAME') <-- See above.
>
> message = """\
> From: %s
> To: %s
> Subject: %s
>
> %s
> """ % (FROM, ", ".join(TO), SUBJECT, TEXT)
>
> # Send message
>
> server = smtplib.STMP(SERVER) <-- Should be: server = smtplib.SMTP(SERVER)
> server.sendmail(FROM, TO, message)
> server.quit()
>
> =============end script=============
>
--
Stephen Haywood
Information Security Consultant
CISSP, GPEN, OSCP
T: @averagesecguy
W: averagesecurityguy.info
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.ale.org/pipermail/ale/attachments/20111117/297f693c/attachment.html