Send mail



  • This post is deleted!


  • Google will only accept it if you send with ssl flags

    Gmail SMTP server address: smtp.gmail.com
    Gmail SMTP username: Your full Gmail address (e.g. yourusername@gmail.com)
    Gmail SMTP password: Your Gmail password
    Gmail SMTP port (TLS): 587
    Gmail SMTP port (SSL): 465
    Gmail SMTP TLS/SSL required: yes

    It turns out that in order for Google to authorize a third party server to access your account via SMTP now, you have to enable “Less Secure Apps” on your gmail account. You can read a full explanation of what risks that subjects you to, and get a full explanation here (https://support.google.com/accounts/answer/6010255), but essentially, any apps that aren’t using security protocols that Google deems mandatory, will be blocked unless you enable the ability for less secure apps to access your gmail account.

    Now while I won’t recommend you allow less secure apps to access your gmail account, it’s currently the only way I know of to allow



  • This post is deleted!


  • I have not tested this, but did you try with TLS and 587 port?

    server = smtplib.SMTP('smtp.gmail.com', 587)
    server.starttls()
    server.login("your.email@gmail.com", "PASSWORD")
    
    msg = "YOUR MESSAGE!"
    server.sendmail("SENDER ADDRESS", "RECIPIENT ADDRESS", msg)
    server.quit()


  • This post is deleted!


  • This post is deleted!


  • Did you enable the "less secure apps" feature on your account as instructed by @chris-mccaslin?



  • This post is deleted!


  • @Rudy-Trujillo said:

    This is what I was trying to avoid.
    Can't help thinking if the SSL part of the information passed to the server could be included in the portion it needs which is "secure connection = yes" it would meet the criteria for Googles security. But how to incorporate it in the python script is what I am looking for if it is possible.

    Just guessing based on what was read in what is needed when attempting to connect to SMTP server.
    Gmail SMTP Server: smtp.gmail.com
    Gmail SMTP password: Your Gmail password
    Gmail SMTP port (TLS): 587
    Gmail SMTP port (SSL): 465
    Gmail SMTP TLS/SSL required: yes<----how does one incorporate this part into the python script?

    I am assuming you already have it ( I don't know python the best)
    but what I make out of it is your making a socket and setting it to be SMTP_SSL and connect to google on the ssl port,

    server = smtplib.SMTP_SSL('smtp.gmail.com:465')
    

    Also try this i justt noticed you did not have ttls enabled

    import smtplib
    sender = 'Myemail@gmail.com'
    toaddrs = 'Myemail@gmail.com'
    
    message = """From: Test send from omega
      To: Recipient < Cold@hotmail.com >
     Subject: SMTP e-mail test
    
    This is a test e-mail message.
    """
    
    
    password = 'password'
    
    server = smtplib.SMTP_SSL('smtp.gmail.com:587')
    server.starttls() #required by google 
    server.login(sender,password)
    server.sendmail(sender, toaddrs, message)
    server.quit()
     #if this does not work, then try this
    

    try this non ssl example if above does not work

      # Credit to pythonforbegginers.com
      # http://www.pythonforbeginners.com/google/sending-emails-using-google
      import smtplib
    
      # Specifying the from and to addresses
    
      fromaddr = 'fromuser@gmail.com'
      toaddrs  = 'touser@gmail.com'
    
      # Writing the message (this message will appear in the email)
    
      msg = 'Enter you message here'
    
      # Gmail Login
    
      username = 'username'
      password = 'password'
    
      # Sending the mail  
    
      server = smtplib.SMTP('smtp.gmail.com:587')
      server.starttls()
      server.login(username,password)
      server.sendmail(fromaddr, toaddrs, msg)
      server.quit()


  • @Rudy-Trujillo you must enable the less secure apps feature directly on your Google account, you cannot work around it just with the Python code.



  • This post is deleted!


  • This post is deleted!


  • This post is deleted!

Log in to reply
 

Looks like your connection to Community was lost, please wait while we try to reconnect.