CopyRight

If you feel that any content has violated the copy-Right law please be free to mail me.
I will take suitable action.
Thanks

Sunday 12 January 2014

Email -Spammer in Python

#Writing an Email Spammer in Python

#First, Importing the Simple Mail Transfer Protocol Module

import smtplib

#Specifying the From and To addresses

fromaddress = "fromaddress@gmail.com"
toaddress = "toaddress@gmail.com"

#Now,Specifying the Gmail Login

username = "yourgmail username"
password = "yourgmail password"

#Writing the message which will appear in the mail

message = """From:CodeScripter
...text here...
"""

#Creating a connection with the Gmail server

server =smtplib.SMTP('smtp.gmail.com:587')
server.starttls()
server.login(username,password)

#Creating a for loop to send multiple mails

for i in range (0,10):
server.sendmail(fromaddress,toaddress,message)
print "mail sent"

#closing the server
server.quit()

8 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. It gives me below error! What should i do to fix it

    raise SMTPAuthenticationError(code, resp)
    smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials x6-v6sm14204701pfe.30 - gsmtp')

    ReplyDelete
  3. how do i choose how many eamils i sends

    ReplyDelete
    Replies
    1. if you change the last number in the range like in this example:

      for i in range (0,44):


      The Spam e-mail will be sent 44 times

      Delete
  4. Changing the value from `10` to any number you want your emails to go out should work.

    ReplyDelete