Google
 
Web pyadmin.blogspot.com

Tuesday, May 02, 2006

some fun with python

Here is a python script for sending email.U may wonder y i need another mail sender. No u don't need one.
but if u just want to play on ur friend by shooting some funny emails without revealing ur identity, u need this one. say if u want to play around a friend pretending as a (fe)male, u can use this script to send him/her an email as sexy(fe)male@heaven.com

Guyz!!!(who thinks pyton in for serious tasks),plz dont scold me. This is meant for newbies.This script reveals the power of python. A newbe can understand this script.

This is a command line tool, and moreover u dont need an email account to send mail to someone. But offcourse u need a mail server,and u cannot recieve get any reply in this (noexistent)email id. This is not a really useful tool. This is for those who are just into python and also to demonstrate the power of python.

#!/usr/bin/python

import smtplib, string, sys, time
"""IP/hostname of ur mail server"""
mailserver = "10.200.9.99"

From = string.strip(raw_input("From: "))
To = string.strip(raw_input("To: "))
Subject = string.strip(raw_input("Subject: "))

Date = time.ctime(time.time())
Header = ("From: %s\nTo: %s\nDate: %s\nSubject: %s\n\n"
% (From, To, Date, Subject))


Text = "your message here"
server = smtplib.SMTP(mailserver)
failed = server.sendmail(From, To, Header + Text)
server.quit()
if failed:
print "failed to send mail"
else:
print "all done.."

0 Comments:

Post a Comment

<< Home