0 votes

I've got some older existing code that works fine but returns errors (about emails not being sent). I tried searching for my problem but the only topic that got close to my question, is the exact inverse (https://www.limilabs.com/qa/1041/sendmessagestatus-return-values).

My problem is; when sending emails returned SendMessageStatus object is always of type SendMessageStatus.Failure. All code (C#) runs fine and the messages ARE being sent correctly, it's just that the return code is Failure instead of the expected Success. I've analysed the implementation of the Limilabs DLL and as far as I can see it looks ok.

What we do:
- We create a Mail.Appointments.Appointment
- Then create and add a Mail.Appointments.Event to it
- Then create and add the appointment to a Mail.MailBuilder
- Then we add an attachment to the builder, some plain Text, and set the From and To address (single, valid To address)
- Then create an IMail object by calling the builder's Create() method
- Then, with a using clause, init Client.SMTP.Smtp and Connect(), StartTLS(), UseBestLogin(), then send the IMail object

As said all is working fine, the emails including the appointment and attachment are received correctly, except the returned ISendMessageResult's Status property is always Failure. I would like to get a correct response so that we can log the failed results and take action when that happens. Currently I have no idea when an email fails as all of them seem to fail, but (most, if not all) don't.

We connect to an external (Office365) mail server and I have verified the account is working fine (as expected since the mails are being sent). Any suggestions on how to tackle this issue?

by (210 points)

1 Answer

+1 vote

First, turn on logging:
https://www.limilabs.com/blog/logging-in-mail-dll

...and check using the latest version
https://www.limilabs.com/mail/download

What happens if you disable:

client.Confiugration.EnableChunking = false;
client.Confiugration.EnablePipelining = false;

What happens if you allow partial sending:

client.AllowPartialSending = true;
by (301k points)
Thanks for the quick reply! Great feature with the logging enabled - now managed to easily track the issue down to the mailserver refusing a specific attachment. Will look into that further but my problems have been solved.
Starting to feel kinda stupid I didn't try to remove the attachment to begin with :( Thanks again!
...