Auto mailing system coding

Here is an example of an auto-mailing system coding in Python using the smtplib and email libraries:

import smtplib
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import time

# Define the email server settings
SMTP_SERVER = 'smtp.gmail.com'
SMTP_PORT = 587
FROM_EMAIL = '[email protected]'
PASSWORD = 'your_password'

# Define the email message
SUBJECT = 'Auto Mailing System'
BODY = 'This is an auto-generated email from the auto-mailing system.'

# Define the recipients
RECIPIENTS = ['[email protected]', '[email protected]', '[email protected]']

# Create a text message
msg = MIMEMultipart()
msg['From'] = FROM_EMAIL
msg['Subject'] = SUBJECT
msg.attach(MIMEText(BODY, 'plain'))

# Connect to the email server
server = smtplib.SMTP(SMTP_SERVER, SMTP_PORT)
server.starttls()
server.login(FROM_EMAIL, PASSWORD)

# Send the email to each recipient
for recipient in RECIPIENTS:
    msg['To'] = recipient
    text = msg.as_string()
    server.sendmail(FROM_EMAIL, recipient, text)
    print(f'Email sent to {recipient}')
    time.sleep(1)  # Add a delay to avoid sending too many emails at once

# Close the email server connection
server.quit()

This code sends an email to each recipient in the RECIPIENTS list using the smtplib library. The email is sent using the FROM_EMAIL address and the PASSWORD is used to authenticate the email.

Please note that you need to replace '[email protected]' and 'your_password' with your actual Gmail email and password. Also, make sure to enable "Less secure app access" in your Google account settings to allow this script to work.

Also, you can use other libraries like yagmail which is a wrapper around smtplib and email libraries, it's more easy to use and it has more features.

You can also use other services like Mailgun, Sendgrid, etc. which are more reliable and scalable.

Please keep in mind that this is just an example, you should adjust the code to fit your specific needs and also make sure to follow the terms of service of the email service you are using.