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
0 answers

How to making the smtlib.SMTP synchronous functions

I am a newbie to python programming. I am writing small smtp client for testing the POSTFIX smtp server implementation. I have used python smtplib for the same. Here is the code snippet. import smtplib def smtpTest(serverStr, mode=1): servername =…
0
votes
1 answer

Can't send current date and time in python smtplib

I am working with smtplib to send emails. However I can't manage to send emails that contain the current time that I get from the time library import smtplib from time import strftime, localtime server = smtplib.SMTP('smtp.gmail.com',…
0
votes
1 answer

Python3 socket.gaierror then calling smtplib.SMTP

Problem description I have implemented function to send email via smtplib in sendmail.py. In main.py I have imported sendmail and use it. Then I run main.py, it crashes on s = smtplib.SMTP(SMTP_SERVER): Traceback (most recent call last): File…
0
votes
1 answer

sequence item 0: expected string, tuple found

(user_mail, ','.join(recipient), mail.as_string()) The above code produces error of expected string but tuple found. How should I fix this? Any solution?
0
votes
1 answer

Python smtplib Tmobile is blocking

I am trying to send a message with python using the smtplib library. Here is the code I am using: server = smtplib.SMTP_SSL('smtp.gmail.com', 465) server.login(EMAIL, PASS) server.sendmail(EMAIL, phone_number +"@"+ carrier_address,…
rishubk
  • 441
  • 2
  • 8
  • 19
0
votes
2 answers

Using python's smtplib, how can I send an email in the future?

I have some sample Python code from here https://docs.python.org/2/library/email-examples.html where I can successfully send emails. # Import smtplib for the actual sending function import smtplib # Import the email modules we'll need from…
Alex F
  • 2,086
  • 4
  • 29
  • 67
0
votes
0 answers

Not able to send the mail without password authentication in python

I am not able to send the mail without password authentication in python.Its printing the last message but mail is not sent.Below is the code that i am using.Anyone please help i am stuck because of this. Thanks in advance. import…
Navneet
  • 45
  • 5
0
votes
1 answer

Sending an E-Mail with attachments

import smtplib server = smtplib.SMTP( "smtp.gmail.com", 587 ) server.starttls() server.login( 'myEmail@gmail.com', 'myPassword' ) file = 'C:\\Users\\PC1\\Desktop\\myFile.txt' f = open(file, "r") filecontent = (f.read()) server.sendmail(…
M. West
  • 9
  • 2
0
votes
1 answer

How to find individual files and email file location in python

I'm trying to perform 2 functions using python. The first function is to find the directory path of all *.txt files within a directory structure. The second is to send the file directory path to an email address in the body of the email. import…
Ben
  • 3
  • 1
0
votes
1 answer

Django CMS SMTP Server -- [Errno 61] Connection refused

I'm using Django CMS with the Aldryn Jobs module installed, by default the Jobs module uses the emailit module, not the core mail module that comes with Django (Still not sure why). My problem is I cannot connect to the SMTP server, whenever the app…
samroberts707
  • 161
  • 2
  • 16
0
votes
2 answers

Send an e-mail using Python 3

I'm working on a guessing game where there are tons of characters and it gives you hints for you to guess the character. There is also going to be a thing where you can submit a character. I want to do it so that it will send me an e-mail if…
0
votes
1 answer

Using function to send gmails via python

Below are 2 code blocks. The first will send a message to gmail with the correct subject and sender. However, when I put the first code into a function, the email loses the sender and subject info. Why is this and how do I fix it? I would like to…
Lisle
  • 1,620
  • 2
  • 16
  • 22
0
votes
0 answers

Can't connect with smtplib to send mail with python

I'm doing a script for send a mail of my company, the host it's a IP so I'm trying to connect on this way (also tryied anothers) but nothing.... This is my code: #!/usr/bin/python # -*- coding: utf-8 -*- import commands import sys import smtplib …
Urkidy
  • 97
  • 9
0
votes
0 answers

Spoof an Email in Python

The title pretty much describes the question. Currently, I am using SMTPlib in python 3.6 and my code, shown below, sends an email with the name changed, but the real sending email address is till there. How would I remove that? import smtplib to =…
Antobat
  • 31
  • 7
0
votes
0 answers

smtplib confustion looking to understand

I am just using windows powershell, python 3.4, and the smtp library. Do I need to set anything else up to solve this error? >>> s=smtplib.SMTP("localhost") Traceback (most recent call last): File "", line 1, in…