- Remove From My Forums
-
Вопрос
-
Добрый день, уважаемые коллеги.
При подключении постового ящика через IMAP к Exchange 2007 клиент Outlook 2007 выходит ошибкаВход на сервер входящей почты (IMAP) Сбой проверки подлинности. Общие. На данном компьютере не поддерживается ни один из способов проверки подлинности, поддерживаемых сервером IMAP (если таковы имеются)
на сервере у ящика IMAP Enabled. Как решить данную проблему не подскажете?
-
Перемещено
12 марта 2012 г. 8:41
forum merge (От:Exchange Server 2007)
-
Перемещено
Ответы
-
Вы это прочитать можете?)
Я вижу у вас включено SSL. Вы клиента соответствующим образом настраиваете? Отключите в настройках IMAP SSL, переключите на plain text и проверьте на клиенте. Скорее всего у вас на клиенте не включено SSL для IMAP.
Для правильного функционирования SSL вам надо сгенерировать сертификат с правильным именем, импортировать его в exchange и включить для службы IMAP.
-
Предложено в качестве ответа
Nikita PanovModerator
10 декабря 2009 г. 7:48 -
Помечено в качестве ответа
Nikita PanovModerator
21 декабря 2009 г. 10:09
-
Предложено в качестве ответа
Comments
frodeaa
added a commit
to frodeaa/offlineimap
that referenced
this issue
Nov 18, 2018
reset the oauth2_access_token before it expires use `expires_in` from oauth2 response to set when the access_token should be cleared divides the `expires_in` by 2 to ensure the access_token is cleared before it expires ref: OfflineIMAP#536
frodeaa
added a commit
to frodeaa/offlineimap
that referenced
this issue
Nov 18, 2018
reset the oauth2_access_token before it expires use `expires_in` from oauth2 response to set when the access_token should be cleared divides the `expires_in` by 2 to ensure the access_token is cleared before it expires ref: OfflineIMAP#536
frodeaa
added a commit
to frodeaa/offlineimap
that referenced
this issue
Nov 18, 2018
Use `expires_in` from the oauth2 response to reset the oauth2_access_token before it expires divides the `expires_in` by 2 to ensure the access_token is cleared before it expires ref: OfflineIMAP#536 Signed-off-by: Frode Aannevik <frode.aa@gmail.com>
nicolas33
pushed a commit
that referenced
this issue
Nov 18, 2018
Use `expires_in` from the oauth2 response to reset the oauth2_access_token before it expires divides the `expires_in` by 2 to ensure the access_token is cleared before it expires ref: #536 Signed-off-by: Frode Aannevik <frode.aa@gmail.com> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Comments
frodeaa
added a commit
to frodeaa/offlineimap
that referenced
this issue
Nov 18, 2018
reset the oauth2_access_token before it expires use `expires_in` from oauth2 response to set when the access_token should be cleared divides the `expires_in` by 2 to ensure the access_token is cleared before it expires ref: OfflineIMAP#536
frodeaa
added a commit
to frodeaa/offlineimap
that referenced
this issue
Nov 18, 2018
reset the oauth2_access_token before it expires use `expires_in` from oauth2 response to set when the access_token should be cleared divides the `expires_in` by 2 to ensure the access_token is cleared before it expires ref: OfflineIMAP#536
frodeaa
added a commit
to frodeaa/offlineimap
that referenced
this issue
Nov 18, 2018
Use `expires_in` from the oauth2 response to reset the oauth2_access_token before it expires divides the `expires_in` by 2 to ensure the access_token is cleared before it expires ref: OfflineIMAP#536 Signed-off-by: Frode Aannevik <frode.aa@gmail.com>
nicolas33
pushed a commit
that referenced
this issue
Nov 18, 2018
Use `expires_in` from the oauth2 response to reset the oauth2_access_token before it expires divides the `expires_in` by 2 to ensure the access_token is cleared before it expires ref: #536 Signed-off-by: Frode Aannevik <frode.aa@gmail.com> Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
Я пытаюсь подключить почтовый ящик Outlook с помощью imap.
Область, определенная для приложения: Разрешение API
Я генерирую токен, используя поток учетных данных клиента:
Ниже приведен запрос, который я отправляю, чтобы получить токен доступа.
grant_type=client_credentials&client_id=MyClientID&client_secret=Mysecret&scope=https://outlook.office.com/.default
Я успешно получил токен.
Вот код, используемый для подключения к IMAP из Java:
Properties props = new Properties();
props.put("mail.imap.ssl.enable", "true");
props.put("mail.imaps.sasl.enable", "true");
props.put("mail.imaps.sasl.mechanisms", "XOAUTH2");
props.put("mail.imap.auth.login.disable", "true");
props.put("mail.imap.auth.plain.disable", "true");
props.put("mail.debug", "true");
props.put("mail.debug.auth", "true");
Session session = Session.getInstance(props);
session.setDebug(true);
String accessToken = "access_token_received_on_previous_step";
final Store store = session.getStore("imaps");
store.connect("outlook.office365.com", 993, "user@outlook.com", accessToken);
Получение ниже ошибки:
A1 AUTHENTICATE XOAUTH2 dXNlcj1zb29yeW.........
A1 NO AUTHENTICATE failed.
javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
Может ли кто-нибудь помочь мне решить проблему
1 ответ
Вы назначили Microsoft Graph делегированное разрешение IMAP.AccessAsUser.All в приложении Azure AD. Но делегированное разрешение не поддерживается для типа предоставления client_credentials.
На основе документация:
Доступ OAuth к протоколам IMAP, POP, SMTP AUTH через поток предоставления учетных данных клиента OAuth2 не поддерживается.
И вам нужно использовать OAuth2 поток кода авторизации или Процесс предоставления авторизации устройства OAuth2.
Кроме того, я думаю, вам может понадобиться установить scope как https://graph.microsoft.com/.default, потому что разрешение теперь находится в Microsoft Graph.
1
Allen Wu
22 Июл 2020 в 03:59
Recently the support for OAuth 2.0 for IMAP and SMTP in the Exchange Online has been announced.
Following the guide I’ve set up the application permissions and IMAP and SMTP connection.
The application is configured as Accounts in any organizational directory (Any Azure AD directory - Multitenant) and uses authorization code flow.
URLs below are used for authorization:
- https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize
- https://login.microsoftonline.com/organizations/oauth2/v2.0/token
And the following Delegated Microsoft Graph scopes have been added:

The scopes, requests from code:
final List<String> scopes = Arrays.asList(
"offline_access",
"email",
"openid",
"profile",
"User.Read",
"Mail.ReadWrite",
"https%3A%2F%2Foutlook.office365.com%2FIMAP.AccessAsUser.All",
"https%3A%2F%2Foutlook.office365.com%2FSMTP.Send"
);
I successfully receive the access and refresh tokens:
{
"token_type": "Bearer",
"scope": "email IMAP.AccessAsUser.All Mail.ReadWrite openid profile SMTP.Send User.Read",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "edited",
"refresh_token": "edited",
"id_token": "edited"
}
Here’s the code, used to connect to IMAP:
Properties props = new Properties();
props.put("mail.imap.ssl.enable", "true");
props.put("mail.imaps.sasl.enable", "true");
props.put("mail.imaps.sasl.mechanisms", "XOAUTH2");
props.put("mail.imap.auth.login.disable", "true");
props.put("mail.imap.auth.plain.disable", "true");
props.put("mail.debug", "true");
props.put("mail.debug.auth", "true");
Session session = Session.getInstance(props);
session.setDebug(true);
String userEmail = "user@domain.onmicrosoft.com";
String accessToken = "access_token_received_on_previous_step";
final Store store = session.getStore("imaps");
store.connect("outlook.office365.com", 993, userEmail, accessToken);
Which generates the following output:
DEBUG: JavaMail version 1.6.2
DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map
DEBUG: setDebug: JavaMail version 1.6.2
DEBUG: getProvider() returning javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Oracle]
DEBUG IMAPS: mail.imap.fetchsize: 16384
DEBUG IMAPS: mail.imap.ignorebodystructuresize: false
DEBUG IMAPS: mail.imap.statuscachetimeout: 1000
DEBUG IMAPS: mail.imap.appendbuffersize: -1
DEBUG IMAPS: mail.imap.minidletime: 10
DEBUG IMAPS: enable SASL
DEBUG IMAPS: SASL mechanisms allowed: XOAUTH2
DEBUG IMAPS: closeFoldersOnStoreFailure
DEBUG IMAPS: trying to connect to host "outlook.office365.com", port 993, isSSL true
* OK The Microsoft Exchange IMAP4 service is ready. [QQBNADc...]
A0 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
A0 OK CAPABILITY completed.
DEBUG IMAPS: AUTH: PLAIN
DEBUG IMAPS: AUTH: XOAUTH2
DEBUG IMAPS: protocolConnect login, host=outlook.office365.com, user=user@domain.onmicrosoft.com, password=<non-null>
DEBUG IMAPS: SASL Mechanisms:
DEBUG IMAPS: XOAUTH2
DEBUG IMAPS:
DEBUG IMAPS: SASL client XOAUTH2
DEBUG IMAPS: SASL callback length: 2
DEBUG IMAPS: SASL callback 0: javax.security.auth.callback.NameCallback@17046283
DEBUG IMAPS: SASL callback 1: javax.security.auth.callback.PasswordCallback@5bd03f44
A1 AUTHENTICATE XOAUTH2 dXNlcj1o...
A1 NO AUTHENTICATE failed.
Exception in thread "main" javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:732)
at javax.mail.Service.connect(Service.java:366)
And the following code is used for connecting to SMTP:
Properties props = new Properties();
props.put("mail.smtp.auth", "true");
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.starttls.enable", "true");
props.put("mail.smtp.auth.mechanisms", "XOAUTH2");
props.put("mail.smtp.auth.login.disable","true");
props.put("mail.smtp.auth.plain.disable","true");
props.put("mail.debug.auth", "true");
Session session = Session.getInstance(props);
session.setDebug(true);
String userEmail = "user@domain.onmicrosoft.com";
String accessToken = "access_token_received_on_previous_step";
Transport transport = session.getTransport("smtp");
transport.connect("smtp.office365.com", 587, userEmail, accessToken);
Which provides the output below:
DEBUG: setDebug: JavaMail version 1.6.2
DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Oracle]
DEBUG SMTP: useEhlo true, useAuth true
DEBUG SMTP: trying to connect to host "smtp.office365.com", port 587, isSSL false
220 AM5PR0701CA0005.outlook.office365.com Microsoft ESMTP MAIL Service ready at Mon, 4 May 2020 15:52:28 +0000
DEBUG SMTP: connected to host "smtp.office365.com", port: 587
EHLO ubuntu-B450-AORUS-M
250-AM5PR0701CA0005.outlook.office365.com Hello [my ip here]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-STARTTLS
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
DEBUG SMTP: Found extension "SIZE", arg "157286400"
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "STARTTLS", arg ""
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "BINARYMIME", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "SMTPUTF8", arg ""
STARTTLS
220 2.0.0 SMTP server ready
EHLO ubuntu-B450-AORUS-M
250-AM5PR0701CA0005.outlook.office365.com Hello [my ip here]
250-SIZE 157286400
250-PIPELINING
250-DSN
250-ENHANCEDSTATUSCODES
250-AUTH LOGIN XOAUTH2
250-8BITMIME
250-BINARYMIME
250-CHUNKING
250 SMTPUTF8
DEBUG SMTP: Found extension "SIZE", arg "157286400"
DEBUG SMTP: Found extension "PIPELINING", arg ""
DEBUG SMTP: Found extension "DSN", arg ""
DEBUG SMTP: Found extension "ENHANCEDSTATUSCODES", arg ""
DEBUG SMTP: Found extension "AUTH", arg "LOGIN XOAUTH2"
DEBUG SMTP: Found extension "8BITMIME", arg ""
DEBUG SMTP: Found extension "BINARYMIME", arg ""
DEBUG SMTP: Found extension "CHUNKING", arg ""
DEBUG SMTP: Found extension "SMTPUTF8", arg ""
DEBUG SMTP: protocolConnect login, host=smtp.office365.com, user=user@domain.onmicrosoft.com, password=<non-null>
DEBUG SMTP: Attempt to authenticate using mechanisms: XOAUTH2
DEBUG SMTP: Using mechanism XOAUTH2
AUTH XOAUTH2 dXNlcj1obW9kaUB...
535 5.7.3 Authentication unsuccessful [AM5PR0701CA0005.eurprd07.prod.outlook.com]
Exception in thread "main" javax.mail.AuthenticationFailedException: 535 5.7.3 Authentication unsuccessful [AM5PR0701CA0005.eurprd07.prod.outlook.com]
at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:965)
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:876)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:780)
at javax.mail.Service.connect(Service.java:366)
What I’ve also tried:
- specifying scopes as
https://graph.microsoft.com/SMTP.Sendand justSMTP.Send - using
https://login.microsoftonline.com/common/url for authentication
Result is always the same.
Is it something I do wrong or there’s a bug somewhere in the support for this from the Microsoft side?
Update 1:
Tried from the command line, but same result:
$ openssl s_client -crlf -connect outlook.office365.com:993
... connection part omitted
* OK The Microsoft Exchange IMAP4 service is ready. [QQBNADYAUAAxADkAMgBDAEEAMAAwADkAMQAuAEUAVQBSAFAAMQA5ADIALgBQAFIATwBEAC4ATwBVAFQATABPAE8ASwAuAEMATwBNAA==]
C01 CAPABILITY
* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+
C01 OK CAPABILITY completed.
A01 AUTHENTICATE XOAUTH2 dXNlcj1obW9kaUBjb...
A01 NO AUTHENTICATE failed.
* BYE Connection is closed. 13
read:errno=0
Update 2:
Tried to create brand new application in the Azure Portal with the following permissions:

And receiving the following screen, when trying to give consent for scopes:

That is odd, because the permissions from Azure Portal don’t specify that the Admin consent is required and my previous app registration doesn’t show such screen when IMAP and SMTP scopes are requested.
Update 3:
Thanks to comments to this post I tried the following scopes:
public static final List<String> SCOPES = Arrays.asList(
"offline_access",
"https%3A%2F%2Foutlook.office365.com%2FIMAP.AccessAsUser.All",
"https%3A%2F%2Foutlook.office365.com%2FSMTP.Send"
);
Which gave me the token below:
{
"token_type": "Bearer",
"scope": "https://outlook.office365.com/IMAP.AccessAsUser.All https://outlook.office365.com/SMTP.Send",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1....",
"refresh_token": "OAQABAAAAAAAm...."
}
IMAP/SMTP auth was successful and I was able to read the inbox + send an email!
But for my application I need also couple of other scopes to use some MS Graph API endpoints (read user profile, messages subscription and messages deletion).
So I tried different scopes:
public static final List<String> SCOPES = Arrays.asList(
"offline_access",
"User.Read",
"Mail.ReadWrite",
"https%3A%2F%2Foutlook.office365.com%2FIMAP.AccessAsUser.All",
"https%3A%2F%2Foutlook.office365.com%2FSMTP.Send"
);
This gave the token (note that scope value differs from the token that actually worked, the permissions don’t have outlook url):
{
"token_type": "Bearer",
"scope": "IMAP.AccessAsUser.All Mail.ReadWrite SMTP.Send User.Read profile openid email",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1Q...",
"refresh_token": "OAQABAAAAAAAm..."
}
Which led to the result I got previously:
A1 NO AUTHENTICATE failed.
Trying all the scopes to be as URLs:
public static final List<String> SCOPES = Arrays.asList(
"offline_access", // or "https%3A%2F%2Fgraph.microsoft.com%2Foffline_access"
"https%3A%2F%2Fgraph.microsoft.com%2FUser.Read",
"https%3A%2F%2Fgraph.microsoft.com%2FMail.ReadWrite",
"https%3A%2F%2Foutlook.office365.com%2FIMAP.AccessAsUser.All",
"https%3A%2F%2Foutlook.office365.com%2FSMTP.Send"
);
Leads to the following error when obtaining the token (the consent step passed successfully):
{
"error": "invalid_request",
"error_description": "AADSTS28000: Provided value for the input parameter scope is not valid because it contains more than one resource. Scope offline_access https://graph.microsoft.com/user.read https://graph.microsoft.com/mail.readwrite https://outlook.office365.com/imap.accessasuser.all https://outlook.office365.com/smtp.send is not valid.rnTrace ID: c3282396-6231-4e11-8300-77bc2ca57f00rnCorrelation ID: 5f5145bf-7114-4e6c-ab11-30e7ff84a056rnTimestamp: 2020-05-06 08:08:48Z",
"error_codes": [
28000
],
"timestamp": "2020-05-06 08:08:48Z",
"trace_id": "c3282396-6231-4e11-8300-77bc2ca57f00",
"correlation_id": "5f5145bf-7114-4e6c-ab11-30e7ff84a056"
}
And when trying all the scopes to have microsoft graph (as copied from the Azure Portal)
public static final List<String> SCOPES = Arrays.asList(
"https%3A%2F%2Fgraph.microsoft.com%2Foffline_access",
"https%3A%2F%2Fgraph.microsoft.com%2FUser.Read",
"https%3A%2F%2Fgraph.microsoft.com%2FMail.ReadWrite",
"https%3A%2F%2Fgraph.microsoft.com%2FIMAP.AccessAsUser.All",
"https%3A%2F%2Fgraph.microsoft.com%2FSMTP.Send"
);
Return the following token (without a refresh token althout offline_access has been requested)
{
"token_type": "Bearer",
"scope": "profile openid email https://graph.microsoft.com/IMAP.AccessAsUser.All https://graph.microsoft.com/Mail.ReadWrite https://graph.microsoft.com/SMTP.Send https://graph.microsoft.com/User.Read",
"expires_in": 3599,
"ext_expires_in": 3599,
"access_token": "eyJ0eXAiOiJKV1..."
}
No success:
A1 NO AUTHENTICATE failed.
So it appears that if you don’t specify Outlook url for scope it’s assumed probably as Graph one which doesn’t allow authorization through IMAP and SMTP.
Update 4:
By requesting all the scopes I need at consent step, then getting first access token with only Graph scopes and the second one using refresh token endpoint specifying Outlook scopes — it worked.
Refresh token method for getting second access token is used because if you try to obtains access token by auth code you’ll get get the following error:
{
"error": "invalid_grant",
"error_description": "AADSTS54005: OAuth2 Authorization code was already redeemed, please retry with a new valid code or use an existing refresh token.rnTrace ID: 09fc80f4-f5fd-4e52-938f-d56b71dd0900rnCorrelation ID: 4f35e05c-23c8-4fdc-a5a7-2fcde5a73b44rnTimestamp: 2020-05-08 12:13:30Z",
"error_codes": [
54005
],
"timestamp": "2020-05-08 12:13:30Z",
"trace_id": "09fc80f4-f5fd-4e52-938f-d56b71dd0900",
"correlation_id": "4f35e05c-23c8-4fdc-a5a7-2fcde5a73b44"
}
So no I’ll need to use two separate tokens depending on what resource I’ll need to manage.
Update 5:
If it still doesn’t work — check if your organization has Security Default enabled — they disable POP/IMAP/SMTP auth for accounts — https://techcommunity.microsoft.com/t5/exchange-team-blog/announcing-oauth-2-0-support-for-imap-and-smtp-auth-protocols-in/bc-p/1544725/highlight/true#M28589
Outlook 2016 Outlook for Office 365 Outlook 2019 Еще…Меньше
Проблемы
При использовании IMAP для подключения к учетной записи электронной почты в Microsoft Outlook 2016, проверка подлинности завершается неудачно.
Причина
Такое поведение наблюдается, поскольку символ Юникода имеет пароль, подобное одному из следующих:
äöü
Обходной путь
Для решения проблемы используйте один из указанных ниже способов.
Метод 1: Изменение пароля
Измените пароль, поэтому он больше не содержит знаки Юникода.
Способ 2: Используйте другой протокол, чем IMAP
Можно настроить учетную запись электронной почты для использования протокола POP3 вместо IMAP, если сервер электронной почты поддерживает подключения POP3. Ниже будет создан новый профиль Outlook, будет настроено для соединения с использованием POP3. Примечание. Протокол POP3 загрузки электронной почты на локальном компьютере и он удаляется с сервера, тогда как IMAP оставляет копию сообщения электронной почты на сервере. Дополнительные сведения содержатся в разделе Понимание различий между POP3 и IMAP4.
-
Закройте приложение Outlook.
-
На панели управления щелкните или дважды щелкните значок Почта. Чтобы найти элемент электронной почты, откройте панель управления и введите в поле поиска в верхней части окна сообщений. Элемент управления панель для Windows XP введите в поле адрес электронной почты .
-
Нажмите кнопку Показать.
-
Нажмите кнопку Добавить.
-
Введите имя профиля и нажмите кнопку ОК.
-
Выберите ручной установкиили дополнительные типы серверови нажмите кнопку Далее.
-
Выберите POP или IMAPи нажмите кнопку Далее.
-
Введите ваши имя и адрес электронной почты и выберите Тип учетной записиPOP3 .
-
Введите сервер входящей почты и сведения о SMTP-сервер исходящей почты, учетные данные для входа и нажмите кнопку Далее. Примечание. Посетите веб-узел узла сервера электронной почты или свяжитесь с ними для сбора сведений сервера входящей и исходящей почты.
-
Чтобы убедиться в их правильности будет выполнена проверка настройки учетной записи:
-
Если тесты выполнены успешно, нажмите кнопку Закрыть.
-
Если появляется сообщение об ошибке во время тестов нажмите кнопку Закрыть. Исправить сведения в настройки учетной записи, а затем повторите шаги 9 и 10 о правильности настроек учетной записи.
-
-
Нажмите кнопку Завершить.
-
Почтаубедитесь, что выбран параметр всегда использовать этот профиль и выберите новое имя профиля из списка.
-
Нажмите кнопку ОК.
Способ 3: Использовать Outlook 2013
Если возможно используйте Outlook 2013 вместо Outlook 2016 для подключения к учетной записи IMAP. Эта проблема не возникает в Outlook 2013.
Статус
Корпорация Майкрософт работает над устранением этой проблемы и опубликует дополнительную информацию в этой статье, когда информация станет доступной.
Нужна дополнительная помощь?
Recently, I am trying to get e-mails from Gmail, using XOAuth2 protocol.
Especially, I am using «OAuth2Authenticator.java» from https://code.google.com/p/google-mail-oauth2-tools/downloads/list.
But, I always get an invalid credential error like the follwoing:
A1 NO [ALERT] Invalid credentials (Failure)
Exception in thread «main» javax.mail.AuthenticationFailedException: [ALERT] Invalid credentials (Failure)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:566)
at javax.mail.Service.connect(Service.java:265)
Before reading, due to the limitation of putting a link, I cannot write «httoo://» so that please think of that this http header is front of some url information.
Before posting this question, I think I looked most of the articles about this one. Many articles are about using OAuth1.0 (deprecated) But, I still cannot figure out how I can make it work with OAuth2 & XOAuth2. I appreciate any suggestion/helps.
The following is the steps I am taking:
-
get an access token through OAuth2 with the scope of mail.google.com/
-
just put this access token & gmail account (e.g. test@gmail.com) into «OAuth2Authenticator.java».
After this procedure, I always get invalid credential.
The interesting stuff is that I can get unread mails through Feed URL (i.e. https://mail.google.com/mail/feed/atom) which is specified in Google OAuth2.0 Playground.
This indicates that I am sure that I get the correct access token. But, does not work at all for IMAP with this sample code.
Actually, the scope «mail.google.com/» is not included in the list of Google OAuth2.0 Playground.
For getting access token for XOAuth2, is there any other special way to get access token?
For the official page about XOAuth2, we need to use base64 to encode the access token.
But, I think the sample code is doing this procedure.
Also, SMTP of this sample did not work at all. But, after changing the properties, I could make it work. Is this code old?
But, unfortunately, what I need is IMAP. But, after trying setting some different/new properties, IMAP does not work at all….
I am stuck on this problem for a long time. So, I posted this question.
I really appreciate any suggestion/helps.
Regards
Recently, I am trying to get e-mails from Gmail, using XOAuth2 protocol.
Especially, I am using «OAuth2Authenticator.java» from https://code.google.com/p/google-mail-oauth2-tools/downloads/list.
But, I always get an invalid credential error like the follwoing:
A1 NO [ALERT] Invalid credentials (Failure)
Exception in thread «main» javax.mail.AuthenticationFailedException: [ALERT] Invalid credentials (Failure)
at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:566)
at javax.mail.Service.connect(Service.java:265)
Before reading, due to the limitation of putting a link, I cannot write «httoo://» so that please think of that this http header is front of some url information.
Before posting this question, I think I looked most of the articles about this one. Many articles are about using OAuth1.0 (deprecated) But, I still cannot figure out how I can make it work with OAuth2 & XOAuth2. I appreciate any suggestion/helps.
The following is the steps I am taking:
-
get an access token through OAuth2 with the scope of mail.google.com/
-
just put this access token & gmail account (e.g. test@gmail.com) into «OAuth2Authenticator.java».
After this procedure, I always get invalid credential.
The interesting stuff is that I can get unread mails through Feed URL (i.e. https://mail.google.com/mail/feed/atom) which is specified in Google OAuth2.0 Playground.
This indicates that I am sure that I get the correct access token. But, does not work at all for IMAP with this sample code.
Actually, the scope «mail.google.com/» is not included in the list of Google OAuth2.0 Playground.
For getting access token for XOAuth2, is there any other special way to get access token?
For the official page about XOAuth2, we need to use base64 to encode the access token.
But, I think the sample code is doing this procedure.
Also, SMTP of this sample did not work at all. But, after changing the properties, I could make it work. Is this code old?
But, unfortunately, what I need is IMAP. But, after trying setting some different/new properties, IMAP does not work at all….
I am stuck on this problem for a long time. So, I posted this question.
I really appreciate any suggestion/helps.
Regards
После регистрации пользователя при попытке отослать письмо для подтверждения регистрации с помощью smtp google на сайте выдает ошибку:
Failed to authenticate on SMTP server with username "mysite@gmail.com" using 3 possible authenticators. Authenticator LOGIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials r12sm7919415ljh.105 - gsmtp ". Authenticator PLAIN returned Expected response code 235 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at 535 5.7.8 https://support.google.com/mail/?p=BadCredentials r12sm7919415ljh.105 - gsmtp ". Authenticator XOAUTH2 returned Expected response code 250 but got code "535", with message "535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials r12sm7919415ljh.105 - gsmtp
в .env вроде все указано верно
MAIL_DRIVER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_USERNAME=mysite@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=tls
-
#2
Код:
++ Starting Swift_SmtpTransport << 220 iva8-b81aeb0c8234.qloud-c.yandex.net ESMTP (Want to use Yandex.Mail for your domain? Visit http://pdd.yandex.ru) >> EHLO forum.ru << 250-iva8-b81aeb0c8234.qloud-c.yandex.net 250-8BITMIME 250-PIPELINING 250-SIZE 42991616 250-AUTH LOGIN PLAIN XOAUTH2 250-DSN 250 ENHANCEDSTATUSCODES >> AUTH LOGIN << 334 VXNlcm5hbWU6 >> c3VwcG9ydEB2aWNlLXNhbXAucnU= << 334 UGFzc3dvcmQ6 >> Nzc1OTk4MjgyODA= << 535 5.7.8 Error: authentication failed: Invalid user or password! !! Expected response code 235 but got code "535", with message "535 5.7.8 Error: authentication failed: Invalid user or password! " (code: 535) >> RSET << 250 2.0.0 Ok >> AUTH PLAIN c3VwcG9ydEB2aWNlLXNhbXAucnUAc3VwcG9ydEB2aWNlLXNhbXAucnUANzc1OTk4MjgyODA= << 535 5.7.8 Error: authentication failed: Invalid user or password! !! Expected response code 235 but got code "535", with message "535 5.7.8 Error: authentication failed: Invalid user or password! " (code: 535) >> RSET << 250 2.0.0 Ok >> AUTH XOAUTH2 dXNlcj1zdXBwb3J0QHZpY2Utc2FtcC5ydQFhdXRoPUJlYXJlciA3NzU5OTgyODI4MAEB << 535 5.7.8 Error: authentication failed: Invalid user or password! !! Expected response code 235 but got code "535", with message "535 5.7.8 Error: authentication failed: Invalid user or password! " (code: 535) >> RSET << 250 2.0.0 OkПри проверке исходящей почты вылазит такая ошибка. Поиском пользовался, но так и не нашел решения проблемы. Возможно, что с паролем накосячил. Но как тогда его узнать, пароль от доменной почты?
Тут же написано
Error: authentication failed: Invalid user or password!
В смысле как узнать?
-
#3
Тут же написано
Error: authentication failed: Invalid user or password!В смысле как узнать?
Так я его указал, все равно эта ошибка
-
#4
Так я его указал, все равно эта ошибка
ну так же все указано: ошибка при аутентификации, неверный логин или пароль
-
#5
ну так же все указано: ошибка при аутентификации, неверный логин или пароль
вот поэтому и написал, потому что не знаю, что не так сделал
-
#6
вот поэтому и написал, потому что не знаю, что не так сделал
указали неверный логин либо пароль. Как подробнее объяснить?)
-
#8
указали неверный логин либо пароль. Как подробнее объяснить?)
Я указал доменную почту support@site.ru и пароль от основного ящика.
-
#10
Точно верно всё настроили и используете судя по ошибке.
Want to use Yandex.Mail for your domain? Visit http://pdd.yandex.ru
-
#11
У Вас недостаточно прав для просмотра ссылок.
Вход или РегистрацияИдеальный мануал
Заходим в раздел админки Настройки — Настройки электронной почты. В поле адрес для возврата писем указываем созданный вами почтовый ящик. Ставим галочку автоматической обработки недоставленных писем и указываем данные для захода на ваш служебный почтовый ящик, которые вы создали ранее: адрес (в случае собственного SMTP-сервера — свой и указывайте), логин (адрес, который вы создали) и пароль от ящика.
Я по этой инструкции и настраивал как раз
Точно верно всё настроили и используете судя по ошибке.
Want to use Yandex.Mail for your domain? Visit http://pdd.yandex.ru
Да, использую smpt сервис от Яндекса
Последнее редактирование модератором: 29 Янв 2021
-
#12
То есть, после создания почтового ящика, Вы зашли в него и всё там подтвердили?
-
#13
То есть, после создания почтового ящика, Вы зашли в него и всё там подтвердили?
Верно, следовал строго инструкции
-
#14
Я бы порекомендовал всё проверить, плюс показать настройки, но всё в теме мануала, если по нему настраивали.
-
#15
Проблема решена.
Можете закрывать.
Спасибо всем за помощь, особенно Mirovinger 🙂
-
#16
Проблема решена.
Можете закрывать.
Спасибо всем за помощь, особенно Mirovinger 🙂
так а что не так было? Чтобы другие знали, если возникнет проблема
-
#17
так а что не так было? Чтобы другие знали, если возникнет проблема
Были некорректные настройки. Я все сбросил и начал настраивать с нуля, следуя инструкции. И все получилось.