Aspose.Email: SmtpException was caught

Hi Support Team,

I am using Aspose.Email to send a Task to the assigned user, Please the below code.

SmtpClient smtpClient = new SmtpClient(“[mail.domain.com](http://mail.domain.com/)”);

smtpClient.UseTnef = true;

smtpClient.Send(eml);

I have tried with username and credential as well as below, but same exception caught

SmtpClient smtpClient = new SmtpClient(“[mail.domain.com](http://mail.domain.com/)”, "abc@domain.com", “abc@123”);

On smtpClient.Send(eml); SmtpException was caught: “Failure Sending mail.” (Unable to read data from the transport connection: The connection
was closed.)

Please assist me on above

With warm regards,

Vipin Panwar

Hi Vipin,

Can you please share your server information that you are using for sending the email? I have tested this issue with Gmail’s Smtp and Exchange server’s SMTP protocol and was not able to face any such issue. Also, please try using the respective port of the server if required such as 587 in case of Gmail. Please share your feedback with us for further assistance.

Hi Muhammad,


I tried with Gmail’s Smtp. Couple of issues i would like to bring into your attention.

1. When I try with Gmail’s Smtp, it send a Task email with ‘winmail.dat’ as the attached file.(with UseTnef= false). Not in case when use alternate System.Net.mail.SmtpClient(that we can’t use to send mapiTask because need a object of System.Net.Mail.MailMessage.)
Please see the attached snap.

2. Email body data is not populated. (it works fine with the Exchange Server.)
MapiTask task = new MapiTask(Task.Subject, body, Task.StartDate.Add(ts), Task.DueDate.Add(ts));

3. The Task that we sent using Gmail’s Smtp is not listed under the Tasks in the Outlook Calendar, not sure why this happened (seems freak behavior).

4. Also if we set True to ‘client.UseTnef’ then it is not showing sender(), that i already reported.(Please see the attached.)

Any suggestion/solution will be helpful for me to resolve the above and to go ahead with the Aspose implementation in future.

Thanks in advance,
Vipin Panwar

Hi Vipin,


Thank you for posting your query.

1. When you intend to send a task using Smtp, you have to use client.UseTenf=true, otherwise WinMail.dat will be associated with the email. The reason for this is that MapiTask is an Outlook type item that has its own specific Mapi properties. These need to be retained while converting MapiTask to MailMessage using InterpretAsTnef. Thus, it is not an issue of the API but a wrong usage of the code sample.

2. I was not able to reproduce this issue at my end as you can see in the attached screenshot where the email body is available at the receiver’s end.

3. When a task is sent using Gmail’s SMTP, it has nothing to do with MS Outlook. Outlook doesn’t know if you have a sent a task using SMTP. If you send a task using Outlook to another user, Outlook also doesn’t show it under calendar items as the task is created for the assigned user and not for the configured Outlook user. If you can do it somehow using MS Outlook, can you please share the steps with us for our investigation?

4. This issue has already been logged and you can wait until it is further investigated by our product team and information is available.

Please let us know if we can be of additional help to you in this matter.