SENDING EMAIL IN PYTHON

Photo of author

By Jackson Taylor

SENDS MAIL WITH MESSAGE HELLO

def send_email():
    import smtplib
    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.ehlo()
    server.starttls()
    server.ehlo()
    #Next, log in to the server
    server.login('jimmypulikottil@gmail.com', 'password')
    #Send the mail
    msg = "nHello!" # The /n separates the message from the headers
    server.sendmail("jimmypulikottil@gmail.com", "e4emerging@gmail.com", msg)
send_email();

NOTES

FOR FIRST TIME YOU WILL GET ERROR MESSAGE AS IN BELOW

“Blocked sign-in attempt for security reasons”

GIVE ALLOW ACCESS. THEN RESEND THE MESSAGE ONCE MORE

Hardware Hack

Stop Buying New Batteries for Your Tech

Electronics are expensive, but their power sources don't have to be. Discover the simple engineering trick to recondition dead batteries and bring your gadgets back to 100% capacity.

Watch the Free Video
See also
LCD ARDUINO

Revive Your Dead Electronics

Got a drawer full of dead gadgets or a failing car battery? Instead of paying a premium for replacements, use this simple trick to easily recondition them right from home.

See How It Works