I made a module to skip mail using smtplib or MIMEText. You can send by specifying the subject, body, source, destination, and Cc in the arguments. Since the sender email I was using this time did not require authentication, I have not created an authentication function. Maybe you can do it with server.login. (I haven't tried it ...)
mail.py
import smtplib
from email.mime.text import MIMEText
def send_mail(subject, body, f_email, t_email, c_email):
#Specifying the destination, email subject, and body
msg = MIMEText(body, "html")
msg["Subject"] = subject
msg["To"] = t_email
msg["From"] = f_email
msg["Cc"] = c_email
#Specify the server. Pass the mail server name and port number to the server and port
server = smtplib.SMTP(server,port)
#send an email
server.send_message(msg)
#close
server.quit()
return
Recommended Posts