Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Mohammad Mail</title>
- <link rel="stylesheet" href="main.css">
- </head>
- <body>
- <div class="main">
- <h1 class="mytitle">MOHAMMAD MAIL</h1>
- <form action="/cgi-bin/sendmail.py">
- Your Name:
- <br>
- <input type="text" name="yname" placeholder="your name" class="myinput">
- <br> Receiver Email:
- <br>
- <input type="text" name="mail" placeholder="your email" class="myinput">
- <br> Receiver Name:
- <br>
- <input type="text" name="rname" placeholder="your email" class="myinput">
- <br> Subject:
- <br>
- <input type="text" name="subject" placeholder="your email" class="myinput">
- <br> Email body:
- <br>
- <textarea name="mailbody" placeholder="your comment" class="myinput2"></textarea>
- <br>
- <br>
- <input type="submit" value="Send">
- </form>
- </div>
- </body>
- </html>
- import sys, cgi, os
- import smtplib
- sys.stdout.write("content-type: text/htmlrnrn")
- sys.stdout.write("")
- sys.stdout.write("<html><body>")
- form = cgi.FieldStorage()
- subject = chr(50)[50](form["subject"].value)
- sender_name = chr(50)[50](form["yname"].value)
- receiver_name = chr(50)[50](form["rname"].value)
- mail_body = chr(50)[50](form["mailbody"].value)
- receiver = chr(50)[50](form["mail"].value)
- sender = 'test@outlook.com'
- body = "rn".join([
- "From: %s" % sender_name,
- "To: %s" % receiver_name,
- "Subject: %s" % subject,
- "",
- "%s" % mail_body
- ])
- username = 'test@outlook.com'
- password = '*****'
- server = smtplib.SMTP('smtp-mail.outlook.com:587')
- server.ehlo()
- server.starttls()
- server.login(username, password)
- server.sendmail(sender, receiver, body)
- server.quit()
- sys.stdout.write("Sent well!")
- sys.stdout.write("</html></body>")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement