0 votes

We have been using this service for a long time but since a month ago we have been having issues where some of the email sent are being duplicated in the receiver's inbox. We have confirmed from our side that we are not sending the same email multiple times.

We are having a hard time recreating the issue because this is ONLY happening for some emails at random.
Below is a stripped out code of what we do to send email.

smtp.UseBestLogin(username, password);

if (smtp.Connected == true)
{
    var result = smtp.SendMessage(email);
    if (result.Status == SendMessageStatus.Success)
    {
        // update database table code
    }
}

Is there anyway that you could help us figure out this issue? Please let me know if any extra information is needed. Any pointers would be helpful. Thank You!

Mail.dll version : 3.0.21189.1553

by (300 points)

1 Answer

0 votes

It doesn't look like a problem with Mail.dll to be honest.

Those emails are received at completely different times (7:08, 7:11, 7:17, 7:23, 7:26, 7:32).

If those emails have multiple recipients (many To, Cc, Bcc addresses for a single email),
SendMessage may return SendMessageStatus.PartialSuccess, if some recipients are accepted but others aren't.

You should examine ISendMessageResult.RejectedRecipients and ISendMessageResult.ApprovedRecipients in such case.

You can also iterate over ISendMessageResult.RejectedRecipientsErrors to obtain actual errors for every recipient.

Mail.dll does not perform any kind of retries when sending messages.

by (272k points)
Could you tell me what could be the possible causes for this? We are so sure that we are not sending the same emails, because our end users are receiving 90-100 copies of same emails and we have flags set up to prevent such situation. Any docs or something that I could follow?
It looks like your application is sending those multiple times.

You can turn on logging to check your conversations to SMTP server:
https://www.limilabs.com/blog/logging-in-mail-dll
Thanks. I will try and monitor this accordingly.
One question:
Do those emails have a single or multiple recipients (many To, Cc, Bcc addresses for a single email?
SendMessage may return PartialSuccess, if some recipients are accepted but others aren't.
They all have MULTIPLE recipients in "To" field.
"SendMessage may return PartialSuccess, if some recipients are accepted but others aren't."  If a partial success is returned then what happens to smtp.SendMessage.Status ?
Also, does mail.dll try to send the email again in such cases or any other case?
ISendMessageResult.Status property is set to SendMessageStatus.PartialSuccess in such case.

You can examine ISendMessageResult.RejectedRecipients and ISendMessageResult.ApprovedRecipients.

You can iterate over ISendMessageResult.RejectedRecipientsErrors to examine actual errors for every recipient

Mail.dll does not perform any kind of retries when sending messages.
Okay. Thank You, I will try it.
Hello, I was able to log the mail.dll successfully. I see that we have a unique message id like "Message-ID: <37762ba4-ee9e-4700-acfe-962c7a408bc7@mail.dll>", I was wondering if it is possible to trace the duplicate issue or any other issue using the message id. Thank you again.
IMail.MessageId is assigned every time you create a new IMail instance using MailBuilder.Create. You can of course assign your own id later on.
...