Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events

Getting error while sending email using Oauth configuration

Avatar

Level 3

Hi Community,

 

I was trying to send email using Oauth configuration from AEM cloud author instance. I have followed these docs for the setup in Azure and in AEM.

 https://aemconcepts.com/home/smtp-integration-with-aemaacs-over-oauth-2-0/ & https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/security/oauth2-...
I was able to send email using postman by Graph API but with AEM it is giving error

 *ERROR* [EventAdminThread #17] com.day.cq.mailer.oauth.impl.OAuthMailerServiceImpl error occurred while sending mail using oauth
javax.mail.MessagingException: 451 4.7.0 Temporary server error. Please try again later. PRX5 [BN9PR03CA0921.namprd03.prod.outlook.com 2024-05-20T12:50:45.241Z 08DC784CD9B28ACE]_

 

AshwiniSathe1_0-1716822787808.png

AshwiniSathe1_1-1716822845134.png

I have tried with different scopes as well but every time I am getting error.

https://graph.microsoft.com/SMTP.Send

https://graph.microsoft.com/Mail.Read

https://graph.microsoft.com/Mail.Send

https://graph.microsoft.com/User.Read

openid

offline_access

email

profile

https://outlook.office365.com/SMTP.Send

Has anyone tried this configs for sending email through Oauth?

2 Replies

Avatar

Level 8

@AshwiniSathe1 

The error "451 4.7.0 Temporary server error. So, it should be a temporary issue with the Microsoft Outlook SMTP server. This doesn't look like related to the AEM or Azure configurations.

But you can check the if the access token provided by Microsoft may have expired (or)
Ensure the AEM proxy host and port are configured correctly to route through the AEM proxy to the Outlook SMTP server. The logs may indicate if AEM is attempting to connect directly instead of through the proxy.

Avatar

Level 3

@gkalyanI have added the egress port for proxy forwards in AEM. Also I checked the access token is valid I am able to send an email using this access token from Postman Graph API. 

I even checked the SMTP settings in mailbox 

AshwiniSathe1_0-1717056223013.png