[FREE] Python Mail Sender

LondoN eXtream

Regular Member
Joined
May 14, 2020
Messages
296
Reaction score
194
Python:
import smtplib
import time
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart

# Read email accounts from a file
with open('email-accounts.txt', 'r') as accounts_file:
    email_accounts = [line.strip().split(':') for line in accounts_file]

# Read the email body from a file
with open('mail-body.txt', 'r') as body_file:
    email_body = body_file.read()

# Create the message
subject = "Your Subject"

message = MIMEMultipart()
message['Subject'] = subject
message.attach(MIMEText(email_body, 'plain'))

# Read the list of recipients from a file
with open('emails.txt', 'r') as file:
    recipients = [line.strip() for line in file]

# Connect to your SMTP server
with smtplib.SMTP('smtp.gmail.com', 587) as server:
    server.starttls()

    # Counter to keep track of the number of emails sent
    email_counter = 0

    # Send emails in a loop
    for recipient in recipients:
        # Get the current email account
        current_account = email_accounts[email_counter % len(email_accounts)]
        current_sender_email, current_password = current_account

        # Set sender and login to the SMTP server
        message['From'] = current_sender_email
        message['To'] = recipient
        server.login(current_sender_email, current_password)

        # Send the email
        server.sendmail(current_sender_email, recipient, message.as_string())
        print(f"Email sent to {recipient} using {current_sender_email}")

        # Increment the email counter
        email_counter += 1

        # 5-second delay between emails
        time.sleep(5)

# Close the connection
server.quit()

This is a simple python mail sender, generated with help of chat GPT to use for cold email campaigns. Requires your own SMTP.

emails.txt -> list of emails to send to
email-accounts.txt -> Your email account, it will switch between then, add them like this: [email protected]:password
mail-body.txt -> Mail body

Can be used for a lot. It cannont figure it out how to add the 2FA to the script but i think as soon as you have a good SMTP still can be used for a lot of stuff.

Just change in the code your smtp server and subject.
 
Back
Top