advanced-cms / advanced-reviews

This is an Open Source add-on that improves the reviewing process and lets external users to view & review content items or whole projects without the need to access the Edit Mode. Created and maintained by Bartosz Sekuła and Grzegorz Wiecheć
Apache License 2.0
17 stars 15 forks source link

Unable to send email to external reviewer #247

Open Perficient-DomKenney opened 6 months ago

Perficient-DomKenney commented 6 months ago

When creating the external review link, the share button correctly pulls up the email modal & I am able to populate this.

However, once I hit the send button it fails to ever send out.

This appears to be happening on multiple clients, and their configuration regarding AdvancedReviews is the same as the test provided in this repo (so far as I have been able to identify).

barteksekula commented 6 months ago

Hi, any callstack?

Perficient-DomKenney commented 6 months ago

The only error I receive is the following output from Application Insights:

{
  "name": "AppRequests",
  "time": "2024-05-06T17:14:43.8227581Z",
  "iKey": "a230e1d2-20b6-49a4-ac58-8e63aeb4bd84",
  "tags": {
    "ai.application.ver": "6.0.0.0",
    "ai.cloud.roleInstance": "localhost",
    "ai.user.id": "VUGN4GI7HHz1ONBtJiwBIR",
    "ai.operation.id": "7e0a2144ace8e5fba7c9738c8eb0114b",
    "ai.operation.name": "POST /EPiServer/advanced-cms-external-reviews/Stores/externalreviewstore/45bb7064-3cce-426a-a2ee-657ef17530ae",
    "ai.location.ip": "127.0.0.1",
    "ai.internal.sdkVersion": "aspnet5c:2.21.0+5e2e7ddda961ec0e16a75b1ae0a37f6a13c777f5",
    "ai.internal.nodeName": "localhost"
  },
  "data": {
    "baseType": "RequestData",
    "baseData": {
      "ver": 2,
      "id": "def65d17006d0586",
      "name": "POST /EPiServer/advanced-cms-external-reviews/Stores/externalreviewstore/45bb7064-3cce-426a-a2ee-657ef17530ae",
      "duration": "00:00:00.0325029",
      "success": false,
      "responseCode": "400",
      "url": "https://localhost:44338/EPiServer/advanced-cms-external-reviews/Stores/externalreviewstore/45bb7064-3cce-426a-a2ee-657ef17530ae",
      "properties": {
        "AspNetCoreEnvironment": "Local",
        "_MS.ProcessedByMetricExtractors": "(Name:'Requests', Ver:'1.1')",
        "DeveloperMode": "true"
      }
    }
  }
}

No breakpoints or logs are generated on any DXP environment, but debugging locally I can see this. This is the only fragment related to this behavior I have been able to identify.

Perficient-DomKenney commented 5 months ago

Hi @barteksekula,

Is there any additional information I should obtain to assist with identifying a cause for this?

barteksekula commented 2 months ago

@Perficient-DomKenney sorry, holidays were a bit busy Please try to add this line to any test controller in your app https://github.com/advanced-cms/advanced-reviews/blob/master/src/Advanced.CMS.ExternalReviews/ReviewLinksRepository/ExternalReviewStore.cs#L147

Does it work? We do not have any email logic inside advanced-reviews, just reusing INotificationProvider from EPiServer.

Perficient-DomKenney commented 2 months ago

I am testing this now, however we have confirmed last week that emails coming from EPiServer Forms are still working without issue. I am uncertain if this would indicate any further context, but it feels relevant to this while I test this scenario.

Perficient-DomKenney commented 2 months ago

@barteksekula Using that line to send an email fails, and this is the exception that is populated from the message error state:

09/10/2024 12:29:29 Failed to send email
MailKit.Net.Smtp.SmtpProtocolException: The SMTP server has unexpectedly disconnected.
   at MailKit.Net.Smtp.SmtpStream.ReadAheadAsync(Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpStream.ReadResponseAsync(Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.SendCommandAsync(String command, Boolean doAsync, CancellationToken cancellationToken)
   at MailKit.Net.Smtp.SmtpClient.AuthenticateAsync(Encoding encoding, ICredentials credentials, Boolean doAsync, CancellationToken cancellationToken)
   at EPiServer.Notification.Internal.SmtpClientImplementation.SendAsync(MimeMessage message)
   at EPiServer.Notification.Internal.EmailNotificationProvider.SendAsync(IEnumerable`1 messages, Action`1 succeededAction, Action`2 failedAction)