Questions tagged [smtplib]

`smtplib` is a Python module that defines an SMTP client session object. It can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon.

smtplib is a Python module that defines an SMTP client session object. It can be used to send mail to any Internet machine with an SMTP or ESMTP listener daemon. For details of SMTP and ESMTP operation, consult RFC 821 (Simple Mail Transfer Protocol) and RFC 1869 (SMTP Service Extensions).

Reference: http://docs.python.org/library/smtplib.html

1300 questions
0
votes
2 answers

Python' smtplib works regularly but not when executing via cron

I have python code that looks like below. It works fine when executed manually. But when executed via a cronjob, the email is not being sent. Here is the code: msg = MIMEMultipart() msg['From'] = sender msg['To'] = to msg['Subject'] =…
0
votes
1 answer

Python code runs fine, until put into a function

So I developed python code that sends a quote in the form of a text message. It runs properly when ran in a simple script. However, once I put the code into a function and call the function then it fails to work. It sends a blank text message,…
Aweava
  • 75
  • 1
  • 5
0
votes
0 answers

Sending gmail using python failing

1. pip error I did pip install smtplib Then it says Could not find a version that satisfies the requirement smtplib (from versions: ) No matching distribution found for smtplib I confirmed that pip install youtube_dl works. So it's probably not…
user3123767
  • 1,115
  • 3
  • 13
  • 22
0
votes
1 answer

Python SMTPlib: Message sending in from header

In Python I'm attempting to send a message via SMTPlib. However, the message is always sending the entire message in the from header, and I have no idea how to fix it. It wasn't doing it before, but now it's always doing it. Here is my code: import…
Dorian Dore
  • 942
  • 4
  • 15
  • 35
0
votes
0 answers

Python sending email with gmail UnicodeEncodeError: 'ascii'

Im having problems with a function that are suppose to connect to google mail and send an email. The function looks like this: def emailSend(fileInput): to = ["blah@blah.com","blah2@blah.com","blah3@blah.com"] toUpdate = to[emailVem] gmail_user =…
Tim
  • 69
  • 10
0
votes
0 answers

error sending multiple mails through smtp

I am trying to develop a small python application that allows it's user to send multiple mails through python, I am using gmail, I have allowed Access for less secure apps, it doesn't send. I have searched stackoverflow for similar problems, but it…
Andrew Meleka
  • 93
  • 1
  • 10
0
votes
1 answer

Sending XML content with smtplib in Python 3

I am trying to send XML content using smtplib in python3. Below is my code: #!/usr/bin/python import smtplib import os fromAddress = "adipratapsingh.aps@gmail.com" toAddress = "adirameshwarsingh.ars@gmail.com" msg = "From: Aditya…
Aditya Singh
  • 2,343
  • 1
  • 23
  • 42
0
votes
0 answers

Python script smtplib for Windows Update notification

I want to send an email using Python smtplib when Windows Update notification is triggered. Anyone have an idea how to accomplish this? I searched on here and Google but didn't find anything. This is the Python code I have to send the…
Mat S
  • 1
  • 2
0
votes
1 answer

Python - print/save the email before sending using smtplib

My objective is to save the email that my script sends using smtplib module. Here is how I am sending the email: #Creating a multipart body msg = MIMEMultipart() #Attaching files to the email for file in tc['attachments']: try: part =…
gixxer
  • 814
  • 1
  • 10
  • 25
0
votes
1 answer

smtplib not send mail with same Subject

I use code below to send mails: ... msg = MIMEText(htmlString, 'html', 'utf-8') msg["Subject"] = "Test Subject" sm = smtplib.SMTP(SMTPSERVER, port=PORT, timeout=TIMEOUT) sm.set_debuglevel(1) # sm.ehlo() # sm.starttls() #…
Simon
  • 1,033
  • 1
  • 8
  • 16
0
votes
1 answer

In python's smtplib why isn't the subject or From field set?

can anyone see why the following code sends emails successfully but it shows up as being from the email address of the sender instead of the name of the sender in the recipients inbox, and the subject shows up as "No Subject" in their inbox. Thanks…
eli
  • 25
  • 6
0
votes
1 answer

Tkinter StringVar Send mail error SMTPlib

I am making an Tkinter app to send a short email. The code in full: from Tkinter import * from smtplib import * from time import sleep root=Tk() root.wm_title("Gmail short message sender") w = 500 # width for the Tk root h = 500 # height for the…
Jonah Fleming
  • 1,187
  • 4
  • 19
  • 31
0
votes
1 answer

attach Json file in email send through smtplib in Python

I have a json file, and want to attach that JSON file in email send by smtplib in Python. But when I open the attachment in email, it can not be correctly parsed as JSON, I believe that there must be some special character there. Here is the code I…
Terry
  • 855
  • 4
  • 12
  • 16
0
votes
1 answer

How to send an email on python without authenticating

I'm trying to send a notification from my Django Application everytime the user perform specific actions, i would like to send those notifications from the email of the person who performed these actions. I don't want them to have to put their…
Luis Del Giudice
  • 81
  • 1
  • 1
  • 2
0
votes
0 answers

smtplib - sender is ignored or email not received

I have an SMTP server running on localhost: python -m smtpd -n -c DebuggingServer localhost:1025 Problems: If I am using gmail config I can send an email from python code. However, the 'From' user is being ignored and it defaults to the username…
zevij
  • 2,416
  • 1
  • 23
  • 32