Adding large attachments to mail using aspose getting stuck

We are trying to add a large attachment of size greater than 1.5GB to a mail using aspose. But the code is getting stuck and not completing even after waiting for hours.

Providing sample code below

String name = "testFile"; // test file with size above 1.5GB (any format)
InputStream fin = new FileInputStream("src/test/resources/" + name); // if running from maven or gradle project
MailMessage mailMessage = new MailMessage(); 
Attachment attachFile = new Attachment(fin, name);
mailMessage.addAttachment(attachFile);
SaveOptions saveOptions = SaveOptions.createSaveOptions(MailMessageSaveType.getOutlookMessageFormatUnicode());
mailMessage.save("testFile.msg", saveOptions);

Any idea why aspose is library is getting stuck in the new Attachment object call ?

Help appreciated.

Hello @akashsudhakar,

Email communication does not involve large-sized attachments.
Handling very large attachments can be quite resource-intensive, and Aspose.Email library is encountering memory limits.
For attachments this large, it might be worth considering an alternative method of sharing, such as providing a download link via a file-sharing service rather than attaching the file directly to the email.