#5, First Floor, 4th Street , Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 pro@slogix.in

Office Address

  • #5, First Floor, 4th Street Dr. Subbarayan Nagar Kodambakkam, Chennai-600 024 Landmark : Samiyar Madam
  • pro@slogix.in
  • +91- 81240 01111

Social List

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

To send an simple mail using SMTP library in python.

Process

  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().

Sapmle Code

#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()