MailCore / mailcore2

MailCore 2 provide a simple and asynchronous API to work with e-mail protocols IMAP, POP and SMTP. The API has been redesigned from ground up.
Other
2.59k stars 623 forks source link

smtp: Unable to authenticate with the current session's credentials. #1946

Open mattaojie opened 2 years ago

mattaojie commented 2 years ago

Summary

I use SMTPSession on our company's email hosting, I got this error:

com.libmailcore.MailException: Unable to authenticate with the current session's credentials. at com.libmailcore.SMTPOperation.exception(SMTPOperation.java:12) at com.libmailcore.SMTPOperation.callCallback(SMTPOperation.java:29) at com.libmailcore.MainThreadUtils.runIdentifierAndNotify(Native Method) at com.libmailcore.MainThreadUtils.access$100(MainThreadUtils.java:8) at com.libmailcore.MainThreadUtils$2.run(MainThreadUtils.java:43) at android.os.Handler.handleCallback(Handler.java:938) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loopOnce(Looper.java:210) at android.os.Looper.loop(Looper.java:299) at android.app.ActivityThread.main(ActivityThread.java:8274) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1073)

I can add my email account on gmail with the same configuration, but not with mailcore2.

Platform(s)

<Android> 9、11、12

Piece of code

val smtpSession = SMTPSession()
        smtpSession.apply {
            setUsername("username")
            setPassword("password")
            setHostname("hostname")
            setPort(587)
            setAuthType(AuthType.AuthTypeSASLLogin)
            setConnectionType(ConnectionType.ConnectionTypeStartTLS)
            setTimeout(15000)
        }
sasinderan commented 1 year ago

I'm also having this issue in iOS in sending mails in outlook using SMTP OAuth.

I have used port: 587 host: " smtp-mail.outlook.com " tried office 365 also username: "***@outlook.com" oAuthToken = "---accessToken---" password = nil isCheckCertificateEnabled = false connectionType: MCOConnectionType.startTLS authType: MCOAuthType.xoAuth2Outlook