MessageID from SendEmail doesn't always match delivery notification

0

During my testing, I have been using the MessageId returned from AmazonSimpleEmailServiceClient::SendEmailAsync as my primary key in my database so I can keep tabs on bounces, complaints, and deliveries for each message sent.

Everything seemed to be working as expected when sending out batches to my 5 test emails during development, however, when I increased my recipients to 30 I noticed some of them never got the delivery notification (but they received the email).

I added logging to my delivery notification lambda and found that sometimes the Mail.MessageId doesn't match any ID's that I have stored in my database. Hence why It looked like I wasn't getting delivery notifications on some recipients.

Any idea why I might be seeing this? I recently made some changes to my DNS to accept receives +MailFrom domain so not sure if that did something funny but everything else seems to be working as expected.

I'm using dotnet core
AWSSDK.SimpleEmail 3.3.101.131
Amazon.Lambda.SQSEvents 1.1.0
Amazon.Lambda.Core 1.1.0

//Sending
var sendEmailResponse = await m_emailClient.SendEmailAsync(email);
recipient.MessageId = sendEmailResponse.MessageId;
//Update to db happens in bulk after the send loop
//Delivery notification
private void ProcessDeliveryEvent(SQSEvent.SQSMessage message)
{
    var notification = JsonConvert.DeserializeObject<AmazonSqsNotification>(message.Body);
    var delivery = JsonConvert.DeserializeObject<AmazonSesDeliveryNotification> (notification.Message);
    UpdateEmailStatusInDatabse(delivery.Mail.MessageId, "Delivered");
}
Jake38
gefragt vor 4 Jahren343 Aufrufe
1 Antwort
0

I was able to resolve this by using raw messages. I included my custom message id when sending raw messages. I then set "Include Original Headers" in my ses notification settings, which allows me to parse the headers in my notification lambdas and extract the desired messageid.

Edited by: Jake38 on Apr 28, 2020 2:34 PM

Jake38
beantwortet vor 4 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen