Research breakthrough possible @S-Logix pro@slogix.in

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • 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().

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