Ready to Start Your Career?

By: cavete
December 7, 2016
Using Python to Send Emails: Terminal Sendmail Command
By: cavete
December 7, 2016

By: cavete
December 7, 2016

#! /usr/bin/pythonimport osimport sysimport subprocessclass color:PURPLE='33[95m'CYAN='33[96m'DARKCYAN='33[36m'BLUE='33[94m'GREEN='33[92m'YELLOW='33[93m'RED='33[91m'BOLD='33[1m'UNDERLINE='33[4m'END='33[0m'print(color.CYAN + "To Send Emails to Email Accounts Or Cellular Devices")print("This Python Program Uses The sendemail Feature in Terminal" + color.END)print(color.BOLD + color.RED + "Written by Cavete <cavete87@gmail.com>nn" + color.END)print(color.BLUE +"Phone Carrier Emails For Mobile Numbers")print("AT&T [10 digit number]@txt.att.net")print("Boost [10 digit number]@myboostmobile.com")print("T-Mobile [10 digit number]@tmomail.net")print("US Cellular [10 digit number]@email.uscc.net")print("Verizon [10 digit number]@vtext.com")print("Virgin Mobile [10 digit number]@vmobl.com")print("Other Carriers From Around the World Can Be Found")print("At www.emailtextmessages.com And")print("At mfitsp.io/list-of-email-to-sms-gateways/")print("Remember SMS Messages Are No More Than 160 Characters Long")print("If Your Message Is Longer, It Will Be Converted To MMS Message")print("Author Takes No Responsibility For How Users Use The Python Script!")print("Use Responsibily Or Accept The Consequences Of Your Actions!n" + color.END)#Remove Comment If You Want To See The sendemail Functions#sndEmail=os.system("sendemail")toAddr=raw_input("Enter Email Address of Receiver: ")fromAddr=raw_input("Enter Your Email Address: ")userName=raw_input("Enter Username For Your Email Account: ")passWord=raw_input("Enter Password For Your Email Account: ")msg=raw_input("Enter Message: ")serverPort=raw_input("Enter Server And Port Number: EX: smtp.gmail.com:587 ")x=(input("Enter The Number of Message Copies To Be Sent: "))for i in range(x):print(subprocess.call(["sendemail", "-t", toAddr, "-f", fromAddr, "-s", serverPort, "-xu", userName, "-xp", passWord, "-m", msg]))`
Again feel free to comment and let me know if there are easier, more efficient, ways of doing the script, or what your opinions of the it are. I did have a great time learning to write and use this script.Build your Cybersecurity or IT Career
Accelerate in your role, earn new certifications, and develop cutting-edge skills using the fastest growing catalog in the industry