1

I have written this program to send out multiple emails to the different variations provided. I am currently using Gmail. I have also used Outlook. Is there a way to get rid of the need for logging into an email account and just send them locally?

I am also looking to get a response if an email actually went through to one of the emails provided or multiples if that's the case. Thank you for your help. This is my first program I've ever written.

import smtplib

# enter gmail login info
email_user = input("Enter your email address")
email_password = input("Enter your password")


# inputs for verification
first_name_input = input(" Enter first name")

last_name_input = input(" Enter last name")

name = first_name_input + last_name_input

domain_input = input(" Enter an email domain(ex. ‘gmail.com’): ")


# email variations list
email1 = name + "@" + domain_input
email2 = first_name_input + "@" + domain_input
email3 = first_name_input + last_name_input[0] + "@" + domain_input
email4 = first_name_input[0] + last_name_input + "@" + domain_input
email5 = first_name_input + "." + last_name_input + "@" + domain_input
email6 = first_name_input + "-" + last_name_input + "@" + domain_input
email7 = last_name_input + "." + first_name_input + "@" + domain_input
email8 = last_name_input + first_name_input + "@" + domain_input
email9 = first_name_input + "_" + last_name_input + "@" + domain_input
email10 = first_name_input[0] + "." + last_name_input + "@" + domain_input
print(email1)
print(email2)
print(email3)
print(email4)
print(email5)
print(email6)
print(email7)
print(email8)
print(email9)
print(email10)


# emails and  content
email_send = email1, email2, email3, email4, email5, email6, email7, email8, email9, email10,
subject = 'Spam'


# email server commands
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(email_user, email_password)

server.sendmail(email_user, email1, subject)
server.sendmail(email_user, email2, subject)
server.sendmail(email_user, email3, subject)
server.sendmail(email_user, email4, subject)
server.sendmail(email_user, email5, subject)
server.sendmail(email_user, email6, subject)
server.sendmail(email_user, email7, subject)
server.sendmail(email_user, email8, subject)
server.sendmail(email_user, email9, subject)
server.sendmail(email_user, email10, subject)
server.quit()
Michael
  • 11
  • 1
  • You can install a local SMTP server, but many if not all your emails will end up in spam/junk folder. – Selcuk Aug 26 '20 at 07:17
  • I am okay with ending up in the spam folder. Is there a way to see if it was delivered to the email address with a local server? My goal is to send out the emails just to confirm if any of them reached an actual inbox whether spam or not. – Michael Aug 26 '20 at 09:28
  • This question is too broad for Stack Overflow but the short answer is no, you can't tell if the mail has been delivered with 100% certainty. See similar questions such as [this one](https://stackoverflow.com/questions/7095104/how-to-confirm-that-mail-has-been-delivered-or-not). – Selcuk Aug 26 '20 at 23:10

0 Answers0