Skip to content

Instantly share code, notes, and snippets.

@jonaslsaa
Created December 3, 2014 12:14
Show Gist options
  • Select an option

  • Save jonaslsaa/0c29281f79e6f295f568 to your computer and use it in GitHub Desktop.

Select an option

Save jonaslsaa/0c29281f79e6f295f568 to your computer and use it in GitHub Desktop.
Email Sender/Handler. No email code.
Your email content here.
test@email.com
def emailHandler(email, email_content):
#Email handler
dummie=1
print("Welcome to Emailer!!!")
print("Made by VOX.")
print("\n"*3)
print("Loading...")
#Include
import os
try:
file_read = open("email_DB.txt", "r")
except IOError:
print("Something wrong happened while trying to read database.")
print("\n")
try:
file_write = open("email_DB.txt", "a")
print("LOADED DATABASE!")
except IOError:
print("Something wrong happened while trying to write to database.")
try:
file_read2 = open("email_CONTENT.txt", "r")
print("LOADED CONTENT!")
except IOError:
print("Something wrong happened while trying to read to CONTENT. Please try again!")
try:
file_write2 = open("email_CONTENT.txt", "a")
except IOError:
print("Something wrong happened while trying to write to CONTENT.")
dummie = raw_input("Press 'Enter' to send all emails!")
num_lines = sum(1 for line in open('email_DB.txt'))
print("LOADED "+str(num_lines)+" emails.")
content = file_read2.read()
for current_email in file_read:
emailHandler(current_email, content)
print("Handeld to this email: " + str(current_email))
file_write.close()
file_read.close()
file_write2.close()
file_read2.close()
dummie = raw_input("\nDone!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment