Simple mail sending using SMTP library in python(without logging into cloud)?

Description

To send an simple mail using SMTP library in python.

   Import SMTP library.

  Type your content.

  Connect g mail port. If you are
 using TLS use 587 port number.

  Create a handshake signal using
 extended hello().

  Login to the account.

  Send the mail using sendmail().

#import libraries

import smtplib

#type your message content

content=”hai”

mail=smtplib.SMTP

(‘smtp.gmail.com’,587)

mail.ehlo()

mail.starttls()

#fill corresponding mail id and password

mail.login(‘from mail id’,’password’)

#sending the email

mail.sendmail(‘from mail id’,’to mail id ‘,content)

#close the mail connection

mail.close()

Leave Comment

Your email address will not be published. Required fields are marked *

clear formSubmit