smtplib

How do i send email from Azure function app

对着背影说爱祢 提交于 2020-05-29 10:49:24
问题 I have running Azure function App(in python language), for business requirements need to send emails from function app. for that, I wrote a python function from email.message import EmailMessage import smtplib def send_mail(): # message to be sent msg = EmailMessage() msg.set_content('Test content') msg['Subject'] = 'Test' msg['From'] = "test@hotmail.com" msg['To'] = ["test@hotmail.com"] # creates SMTP session s = smtplib.SMTP('smtp-mail.outlook.com', 587) s.ehlo() # start TLS for security s

SMTP AUTH extension not supported by server

眉间皱痕 提交于 2020-05-09 18:40:08
问题 Using python I want to send email from my app but it shows the error SMTP AUTH extension not supported by server Code for the program, import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText fromaddr = "test1@example.com" toaddr = "test2@example.com" msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr msg['Subject'] = "Test Mail" body = "Test mail from python" msg.attach(MIMEText(body, 'plain')) server = smtplib.SMTP('smtp.example.com', 25)

Send the contents from unmodified print statement by e-mail in python

倾然丶 夕夏残阳落幕 提交于 2020-04-18 06:12:08
问题 I have a script that runs main() and at the end I want to send the contents it has by e-mail. I don't want to write new files nor anything. Just have the original script be unmodified and at the end just send the contents of what it printed. Ideal code: main() send_mail() I tried this: def main(): print('HELLOWORLD') def send_email(subject='subject', message='', destination='me@gmail.com', password_path=None): from socket import gethostname from email.message import EmailMessage import

How to send an email without login to server in Python

一个人想着一个人 提交于 2020-03-17 07:38:39
问题 I want to send an email without login to server in Python. I am using Python 3.6. I tried some code but received an error. Here is my Code : import smtplib smtpServer='smtp.yourdomain.com' fromAddr='from@Address.com' toAddr='to@Address.com' text= "This is a test of sending email from within Python." server = smtplib.SMTP(smtpServer) server.set_debuglevel(1) server.sendmail(fromAddr, toAddr, text) server.quit() I expect the mail should be sent without asking user id and password but getting an

SSL error on Raspberry Pi

社会主义新天地 提交于 2020-02-25 08:44:11
问题 I recently purchased a Raspberry Pi to run some Python scripts, but when I ported it the function I wrote to send emails through Windows Live suddenly started handing out an SSL error after successful handshake, specifically: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number After extensive searching around, I found many people with the same error, but all in vastly different situations. The most relevant thing I could find was that it seemed to be an issue with a specific

SSL error on Raspberry Pi

久未见 提交于 2020-02-25 08:43:08
问题 I recently purchased a Raspberry Pi to run some Python scripts, but when I ported it the function I wrote to send emails through Windows Live suddenly started handing out an SSL error after successful handshake, specifically: error:1408F10B:SSL routines:SSL3_GET_RECORD:wrong version number After extensive searching around, I found many people with the same error, but all in vastly different situations. The most relevant thing I could find was that it seemed to be an issue with a specific

Errors when using SMTPLIB SSL email with a 365 email address

独自空忆成欢 提交于 2020-01-25 07:55:07
问题 context = ssl.create_default_context() with smtplib.SMTP_SSL("smtp.office365.com", 587, context=context) as server: (587) When I run this I get an SSL error: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1056). (465) I get a timeout error. I tried using ports 465 and 587. I get different errors when I use different ports. I did try 995 just for the heck of it and still no luck. If I use my gmail account, I have no issues. Is there something I need to do to my email account so it

Failing to send email with the Python example

随声附和 提交于 2020-01-09 08:46:13
问题 I've been trying (and failing) to figure out how to send email via Python. Trying the example from here: http://docs.python.org/library/smtplib.html#smtplib.SMTP but added the line server = smtplib.SMTP_SSL('smtp.gmail.com', 465) after I got a bounceback about not having an SSL connection. Now I'm getting this: Traceback (most recent call last): File "C:/Python26/08_emailconnects/12_29_EmailSendExample_NotWorkingYet.py", line 37, in <module> server = smtplib.SMTP('smtp.gmail.com', 65) File "C

getting a blank email

旧街凉风 提交于 2020-01-06 06:54:26
问题 I have quickly written below code to send data being sent to REST remote server for debuging but I am receiving blank email. now sure what is going wrong . in the terminal body dict text or json converted text is getting printed but getting nothing in email. # For testing def sendMail(usr, pwd, to, body): """ just for testing to send error via email """ fromaddr = usr toaddr = to msg = MIMEMultipart() msg['From'] = fromaddr msg['To'] = toaddr msg['Subject'] = "Data add request" try: server =

send email to localhost from localhost via python

会有一股神秘感。 提交于 2020-01-05 15:18:11
问题 I'm building and testing a web service on my local machine before i put it in production. I want to test the mail service. I'm using the standard python email and smtplib libraries. import smtplib from email.mime.text import MIMEText fp = open('textfile', 'rb') msg = MIMEText(fp.read()) fp.close() me = 'me_email@localhost' you = 'me_again_email@localhost' msg['Subject'] = 'The contents of %s' %fp msg['From'] = me msg['To'] = you s = smtplib.SMTP('localhost') s.sendmail(me, [you], msg.as