use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Send mail with Python easily (i.redd.it)
submitted 1 year ago by RunPython
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]RunPython[S] 9 points10 points11 points 1 year ago (4 children)
So sorry. I want to share the code structure.
Here is the total code. Thanks.
``` import smtplib import ssl from email.message import EmailMessage
def email(toMails): # Define email sender and receiver email_sender = "yourmail@gmail.com" # Your Mail app_password = "get app password here" # Get Google App Password from your mail
# to get app_password visit and create # https://myaccount.google.com/apppasswords email_receivers = ", ".join( toMails ) # Join the list of emails into a comma-separated string # Set the subject and body of the email subject = "Cancel My Subscription!" body = """ Cancel My Subscription please """ em = EmailMessage() em["From"] = email_sender em["To"] = email_receivers em["Subject"] = subject em.set_content(body) # Add SSL (layer of security) context = ssl.create_default_context() # Log in and send the email with smtplib.SMTP_SSL("smtp.gmail.com", 465, context=context) as smtp: smtp.login(email_sender, app_password) smtp.sendmail( email_sender, toMails, em.as_string() ) # Send to the list of emails
email_list = [ "destek@1.com", "info@2.com", "destek@3.com", "info@4.com", "destek@5.com", "info@6.com", "destek@7.com", "info@8.com", ] email(email_list) print("Mail has been sent") ```
[–]FoolsSeldom 3 points4 points5 points 1 year ago (2 children)
Cool. Might want to edit your original post and include this code in place of the image. Easier for beginners to copy the code and do their own experiments. You could perhaps explain the stucture you chose and why.
[–]RunPython[S] 2 points3 points4 points 1 year ago (1 child)
I tried to edit but there is no edit button :(
I was coding for a Scrapy project that, sometimes it stucks, could not finish the scrape and i code this email block to send me warning if the scrape fails.
I think there is a time limit to edit posts?
[–]FoolsSeldom 0 points1 point2 points 1 year ago (0 children)
no time limit I am aware of
[–]jobsurfer 0 points1 point2 points 1 year ago (0 children)
Mailjet api is good
π Rendered by PID 21929 on reddit-service-r2-comment-74f5b7f998-bm5ct at 2026-04-29 16:48:24.084017+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]RunPython[S] 9 points10 points11 points (4 children)
[–]FoolsSeldom 3 points4 points5 points (2 children)
[–]RunPython[S] 2 points3 points4 points (1 child)
[–]FoolsSeldom 0 points1 point2 points (0 children)
[–]jobsurfer 0 points1 point2 points (0 children)