Free Support Forum -

Failure Sending Email (Aspose.Email)


I am getting below error when try to send email using ASPOSE SmtpClient. See the attached snap.

Exception: Failure Sending Email
Details: "Unable to read data from the transport connection: The connection
was closed.​"

Please assist me why ASPOSE.Email throwing this exception. Below are the piece of code.

SmtpClient smtpClient = new SmtpClient(“”);
smtpClient.UseTnef = true;



Hi Vipin,

Thank you for using Aspose.Email API.

Can you please make sure that you are initializing the SmtpClient properly? In your sample code, I can see that you are only providing the smtp host name in the constructor to SmtpClient and no other information such as port, username and password is specified. Please try adding this information as well and let us know your feedback.


SmtpClient client = new SmtpClient("", username, password);


I am passing username and password, but not showing here to hide them.

When I try with port then it’s giving below another error.
Source: Aspose.Email
Detail: “Authentication failed because the remote party has closed the
transport stream.”}

It seems like something wrong that is blocking or not allowing SMTP to send email.

If you have any idea then please share what will be the possible cause?


Hi Vipin,

Please try setting the SecurityOptions to Auto and then check. If the issue still persists, please share your test account credentials with us so that we can further investigate it at our end and assist you. Provision of a test account credentials will help us save time by investigating the issue with the real test account.

hi, muhammand, i got this error too.

when is use version 5.1, everything is ok, after i change to 5.3, this error will be throw.

than i use latest version 5.4, will throw this error again.

i think there has something mistake about new version.

my test code:
Stream stream = new MemoryStream();
doc.Save(stream, ADoc.SaveFormat.Mhtml);
stream.Position = 0;
AMail.MailMessageLoadOptions opt = new AMail.MailMessageLoadOptions(AMail.MessageFormat.Mht);
AMail.MailMessage msg = AMail.MailMessage.Load(stream, opt);
AMail.SmtpClient client = GetSmtpClient();
// 发送邮件

Hi Pyntia,

Thank you for writing to Support team.

We have tested this issue at our end with Gmail Smtp settings and the email is sent out successfully without any error. Could you please share your test account credentials with us so that we can investigate the issue and assist you further.


please see the attechment. please check it. thanks

Hi Pyntia,

I have tried to send the mail using these credentials with Aspose.Email but could not succeed. I have logged this issue in our bug reporting system under id:EMAILNET-34852 for further investigation by the product team. I shall write here as soon as some feedback is received in this regard.