3 Replies Latest reply on Nov 24, 2014 2:07 PM by JPMontero_Intel

    Sending emails from Galileo

    josesacerio

      I have tried several of the methods posted in this forum to send email from my Galileo Gen 1 board and all have failed. All my tries have involved connecting to smtp.gmail.com port 587, 465 and 25. The failure has always been related to the authentication although I have had a valid gmail account for years and use it regularly.

       

      Any help to resolve this would be greatly appreciated.

       

      Jose Sacerio

        • 1. Re: Sending emails from Galileo
          JPMontero_Intel

          Hi josesacerio,

           

          Could you please provide the code you used? So we can check it out. What methods did you try? Have you tried with an email account that is not from gmail?

           

          Regards,
          JPMontero_Intel

          • 2. Re: Sending emails from Galileo
            josesacerio

            JP:

             

            I used the same code that jhmurry_intel posted:

             

             

            import smtplib

            fromaddr = 'myemail@gmail.com'

            toaddrs  = 'toemail@gmail.com'

            msg = "\r\n".join([

              "From: myemail@gmail.com",

              "To: toemail@gmail.com",

              "Subject: Alert!",

              "",

              "Something happened"

              ])

             

             

            username = 'myemail@gmail.com'

            password = 'mypassword'

            server = smtplib.SMTP('smtp.gmail.com:587')

            server.ehlo()

            server.starttls()

            server.login(username,password)

            server.sendmail(fromaddr, toaddrs, msg)

            server.quit()

             

            Except I added the debug command to se what was happening. The results are below:

             

            root@quark015871:~# python mailer.py

            send: 'ehlo [192.168.1.66]\r\n'

            reply: '250-mx.google.com at your service, [23.116.176.98]\r\n'

            reply: '250-SIZE 35882577\r\n'

            reply: '250-8BITMIME\r\n'

            reply: '250-STARTTLS\r\n'

            reply: '250-ENHANCEDSTATUSCODES\r\n'

            reply: '250-PIPELINING\r\n'

            reply: '250-CHUNKING\r\n'

            reply: '250 SMTPUTF8\r\n'

            reply: retcode (250); Msg: mx.google.com at your service, [23.116.176.98]

            SIZE 35882577

            8BITMIME

            STARTTLS

            ENHANCEDSTATUSCODES

            PIPELINING

            CHUNKING

            SMTPUTF8

            send: 'STARTTLS\r\n'

            reply: '220 2.0.0 Ready to start TLS\r\n'

            reply: retcode (220); Msg: 2.0.0 Ready to start TLS

            send: 'ehlo [192.168.1.66]\r\n'

            reply: '250-mx.google.com at your service, [23.116.176.98]\r\n'

            reply: '250-SIZE 35882577\r\n'

            reply: '250-8BITMIME\r\n'

            reply: '250-AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER\r\n'

            reply: '250-ENHANCEDSTATUSCODES\r\n'

            reply: '250-PIPELINING\r\n'

            reply: '250-CHUNKING\r\n'

            reply: '250 SMTPUTF8\r\n'

            reply: retcode (250); Msg: mx.google.com at your service, [23.116.176.98]

            SIZE 35882577

            8BITMIME

            AUTH LOGIN PLAIN XOAUTH XOAUTH2 PLAIN-CLIENTTOKEN OAUTHBEARER

            ENHANCEDSTATUSCODES

            PIPELINING

            CHUNKING

            SMTPUTF8

            send: 'AUTH PLAIN AGpvc2VzYWNlcmlvQGdtYWlsLmNvbQBHMTk0Nm9vZw==\r\n'

            reply: '534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbvq_\r\n'

            reply: '534-5.7.14 mbPvULgffIK2Y9NoN9_zbPAAUJVwRkMnyhWNKa2-8tLTbeC9LcM_tutdCAccvVQXG0ZV_B\r\n'

            reply: '534-5.7.14 LdlQ43O8gRyJese_5bNpk7XNsM6MQlRjBoicv0ASqmej-g-eKV-11122sbIqSL1DSln4wG\r\n'

            reply: '534-5.7.14 xNT6usiccsMJ8mpysvHtAePbhSljfU-swqoA_TJgR_dslsxuCP4HqTp1OrEMuIKzcV6Iqx\r\n'

            reply: '534-5.7.14 2mgNozQ> Please log in via your web browser and then try again.\r\n'

            reply: '534-5.7.14 Learn more at\r\n'

            reply: '534 5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 f71sm2495719yha.42 - gsmtp\r\n'

            reply: retcode (534); Msg: 5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbvq_

            5.7.14 mbPvULgffIK2Y9NoN9_zbPAAUJVwRkMnyhWNKa2-8tLTbeC9LcM_tutdCAccvVQXG0ZV_B

            5.7.14 LdlQ43O8gRyJese_5bNpk7XNsM6MQlRjBoicv0ASqmej-g-eKV-11122sbIqSL1DSln4wG

            5.7.14 xNT6usiccsMJ8mpysvHtAePbhSljfU-swqoA_TJgR_dslsxuCP4HqTp1OrEMuIKzcV6Iqx

            5.7.14 2mgNozQ> Please log in via your web browser and then try again.

            5.7.14 Learn more at

            5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 f71sm2495719yha.42 - gsmtp

            Traceback (most recent call last):

              File "mailer.py", line 22, in <module>

                server.login(username, password)

              File "/usr/lib/python2.7/smtplib.py", line 620, in login

                raise SMTPAuthenticationError(code, resp)

            smtplib.SMTPAuthenticationError: (534, '5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbvq_\n5.7.14mbPvULgffIK2Y9NoN9_zbPAAUJVwRkMnyhWNKa2-8tLTbeC9LcM_tutdCAccvVQXG0ZV_B\n5.7.14 LdlQ43O8gRyJese_5bNpk7XNsM6MQlRjBoicv0ASqmej-g-eKV-11122sbIqSL1DSln4wG\n5.7.14 xNT6usiccsMJ8mpysvHtAePbhSljfU-swqoA_TJgR_dslsxuCP4HqTp1OrEMuIKzcV6Iqx\n5.7.14 2mgNozQ> Please log in via your web browser and then try again.\n5.7.14 Learn more at\n5.7.14 https://support.google.com/mail/bin/answer.py?answer=78754 f71sm2495719yha.42 - gsmtp')

             

            I have not tried it with my ISP server or any other server.

             

            Any help will be more than welcome!

             

            Regards,

             

            José

             

            • 3. Re: Sending emails from Galileo
              JPMontero_Intel

              Hi José,

               

              You need to enable the Access for less secure apps in Gmail's security options. That worked for me.

              gmail.PNG

               

              Let me know if that work for you as well.

               

              Regards,
                JPMontero_Intel