简体   繁体   中英

gmail for work cannot send email with SMTP

I am trying to send email to another email address..

my code run well if i am using this as my email server.

    grails {
    mail{
//      teravin smtp setting
        host = "smtp.gmail.com"
        port = 465
        username = "myname@gmail.com"
        password = "ping123456"
        props = ["mail.smtp.auth":"true",
                "mail.smtp.socketFactory.port":"465",
                "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
                "mail.smtp.starttls.enable": "true",
                "mail.smtp.socketFactory.fallback":"false"]

    }
}

but i tried to using Gmail For Work like this

grails {
        mail{
    //      teravin smtp setting
            host = "smtp.gmail.com"
            port = 465
            username = "myname@mydomain.com" //here i am using a domain. like dwayne@alibaba.com
            password = "ping123456"
            props = ["mail.smtp.auth":"true",
                    "mail.smtp.socketFactory.port":"465",
                    "mail.smtp.socketFactory.class":"javax.net.ssl.SSLSocketFactory",
                    "mail.smtp.starttls.enable": "true",
                    "mail.smtp.socketFactory.fallback":"false"]

        }
    }

then i get an error like this..

534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbu7
A
534-5.7.14 Armc1Kv6BMKJgBgDa5JMjBolFfZ-IxR1po773uTSasXpJcLSemxn58swxGL_3zIOhnNVF
N
534-5.7.14 5g0y20MA6FFEVrE_xzqcpS3SooMYLpr2_WWtgnNBSZi4Ycnq1SrGv-rqZ50fnOA8GPLdp
I
534-5.7.14 15howBb6bqYod_AsiKgjkfKGXK1z1F_0u79m3UmYfQXAjnai49pMz5GZkvp6oDYxEClM3
x
534-5.7.14 1CmWME6Jbkph6tVkdGd-yjlHow9c> Please log in via your web browser and
534-5.7.14 then try again.
534-5.7.14  Learn more at
534 5.7.14  https://support.google.com/mail/answer/78754 f21sm1805436pfd.6 - gsm
tp
. Stacktrace follows:
Message: 534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt
=AKgnsbu7A
534-5.7.14 Armc1Kv6BMKJgBgDa5JMjBolFfZ-IxR1po773uTSasXpJcLSemxn58swxGL_3zIOhnNVF
N
534-5.7.14 5g0y20MA6FFEVrE_xzqcpS3SooMYLpr2_WWtgnNBSZi4Ycnq1SrGv-rqZ50fnOA8GPLdp
I
534-5.7.14 15howBb6bqYod_AsiKgjkfKGXK1z1F_0u79m3UmYfQXAjnai49pMz5GZkvp6oDYxEClM3
x
534-5.7.14 1CmWME6Jbkph6tVkdGd-yjlHow9c> Please log in via your web browser and
534-5.7.14 then try again.
534-5.7.14  Learn more at
534 5.7.14  https://support.google.com/mail/answer/78754 f21sm1805436pfd.6 - gsm
tp

i wonder why i get this error...is this because i still using trial account ?

A clue to your solution lies in the error message specifically,

https://support.google.com/mail/answer/78754

Try following the "Troubleshoot" section there.

I've had this problem before and solved it using one of these steps mentioned in that page:

Sign in to your account from the web version of Gmail at https://mail.google.com . Once you're signed in, try signing in to the mail app again.

Visit http://www.google.com/accounts/DisplayUnlockCaptcha and sign in with your Gmail username and password. If asked, enter the letters in the distorted picture.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM