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
-1
votes
1 answer

I want to send email based upon a pandas column

df1 = {'loc': ['blr', 'del','che'], 'name': ['abc', 'xyz','def']} df2 = {'loc': ['blr', 'del','che'], 'balance': ['30', '40','20']} I want to send emails from python. For every loc in df2, the df2 part containing that location and balance needs to…
-1
votes
1 answer

Using os.environ to access environment variables?

I'm trying to access the email address and email password of the current user environment but when I try to print the herein variables 'EMAIL_ADDRESS' and 'EMAIL_PASSWORD', I get None values. I'm using an Android phone to code this simple project.…
Hayness
  • 9
  • 5
-1
votes
2 answers

How to iterate values from a dataframe and pass the values to a send email function in Python

I Have a dataframe (df) like below Subject To_Address CC_Address Backup_Address Invoice 2345 is invalid xyz@gmail.com koke@gmail,ali@gmail.com a@gmail.com Invoice 3456 is invalid …
Rahul rajan
  • 1,186
  • 4
  • 18
  • 32
-1
votes
1 answer

Sending email using Python Script

I am trying to write out a function that will automate sending emails to a specific account. When I run my code I get the error message: Email could not send Traceback (most recent call last): File "email.py", line 1, in import…
Emm
  • 2,367
  • 3
  • 24
  • 50
-1
votes
1 answer

Python emailing pdf getting unexpected keyword argument 'main_type'

I am trying to attach a pdf and send an email in python. Getting below error- TypeError: set_bytes_content() got an unexpected keyword argument 'main_type'. Newbie here, dont know what i am doing wrong? import os import smtplib from email.message…
MRM
  • 37
  • 2
  • 8
-1
votes
1 answer

Sending a link through smtplib and python

I am using smtplib to send text messages as alerts to my phone for a certain event on a website. I have all the webscraping figured out, but when I attach the link I want sent in the text message, it just freaks out and sends a blank message. Any…
washedben
  • 29
  • 2
-1
votes
1 answer

I keep getting an error. I have turned allowed mails from less secure sources as well yet this is happening

if choose=="Dr.Xyz": print() dbt=input("What doubt do you have for Dr.Xyz?: ") content="Dear Tutor, following is the asked doubt along with the name, email of the student: ",dbt, "\t Name and…
-1
votes
1 answer

I don't understand why I get a "too many values to unpack" error

When I run this I can get it to ask me for my password but when it start my "for" loop, I get a error regrading my data. import csv, smtplib, ssl import pandas as pd newhire = pd.read_csv('New_Hires_Test.csv', delimiter = ",", skiprows=7) #Open…
Roberto Gonzalez
  • 37
  • 1
  • 2
  • 9
-1
votes
2 answers

SMTPLIB-email on Cronjob fails

I am trying to send an email from a cronjob via smtplib. Running the python-script as user or as root works correctly, however as a cron-job I "think" I get problems connecting to the server. The code itself is the following: import smtplib,…
ye_ol_man
  • 37
  • 6
-1
votes
1 answer

Setting timeout in smtplib

How can I set a timeout for a gmail server in smtplib.SMTP()? My code: import smtplib server = smtplib.SMTP("smtp.gmail.com" ,587) smtplib.SMTP("smtp.gmail.com" ,587)
kaveh
  • 3
  • 2
-1
votes
1 answer

Multiple recipient is not working in python smtp lib

Im using python 2.7 Im trying to send emails to more than one person. Only one person receives not others. My code is; import smtplib import time from email.header import Header from email.mime.multipart import MIMEMultipart from email.mime.text…
Ratha
  • 9,434
  • 17
  • 85
  • 163
-1
votes
1 answer

Is there a way to fix Python strings embedded in html email body from returning "none"?

Python strings embedded or inserted in html email bodies return 'none' in the body of the sent email. I imported a .py file named Bscrape.py as a module and called it's function. This worked, but when i try to print the string as print(k), i get a…
Runner
  • 1
  • 1
-1
votes
1 answer

I can't add a subject with SMTLIB | Python

my friend and I have been coding an email sender, but we can't send a subject with the email if you could help; much appreciated: import smtplib def send_email(send_to, subject, message): server = smtplib.SMTP_SSL('smtp.gmail.com', 465) …
FlatBoulders
  • 75
  • 2
  • 3
  • 14
-1
votes
1 answer

Printing mutiple HTML tables using tabulate in python

I want to produce two HTML tables using tabulate package, but I am only able to produce one table and send mail. Is it possible to put more than one html table into a message sent with smtplib and email? Whenever I use attach() for more than one…
-1
votes
1 answer

I am getting Authentication Error while logging in to my gmail account using smptlib

I have enabled my POP and IMAP but still it is throwing an error while logging in to gmail account...Here is my code import smtplib host="smtp.gmail.com" port=587 username="bilalgcu29@gmail.com" password="xyz" connection =…