Getting error "HTTP Request: Error while copying content to a stream." when sending mail

Title, basically.

I am working on a process that sends an email with an Excel file attached via Mailjet with an HTTP Request. The attachment in question has a size of roughly 13MB and I have seen that Mailjet has a 15MB limit with what you can send with their service.

I know that the answer might be obvious and that this could be a redundant question but do you guys think that the error: HTTP Request: Error while copying content to a stream could be because the whole thing, mail and attachment, has a larger size than 15MB or that there is another mistake lurking around?

Thank you all.

@ulises.ariza,

I would suggest to test the code with smaller size of the attachment to see if the attachment size is the problem or not.

Hi @ulises.ariza

Try zipping the 13MB file to reduce its size slightly, and ensure your HTTP Request in UiPath is properly configured with the correct headers and body format. Also, test sending the email without the attachment to confirm the issue is with the file size.

I forgot to mention that I am also sending emails with attachments using the same steps but with a 3-5MB attachment and that one works fine. So it all points to the size in this case.
I feel the error message is too lackluster and that’s why I wanted someone else to tell me other than my intuition.

@ulises.ariza,

This is what I found. It could be your ISP blocking it.

https://documentation.mailjet.com/hc/en-us/articles/360043179773-What-is-the-size-limit-for-attachments-files-sent-via-Mailjet

https://documentation.mailjet.com/hc/en-us/articles/360043179793-How-to-add-an-attachment-to-a-campaign#:~:text=For%20users%20who%20require%20attachments,email%20must%20not%20exceed%2015MB.

Would you believe if I tell you that I read the previous sentence and just stopped there?

Thank you so much for pointing this out.

1 Like

Yeah :smiley: that happens with me as well @ulises.ariza!
Cheers!

In any case, after reading the documentation should’t the problem happen after sending the mail? I get that the ISP would flag it down but the problem happens when I pass the json to the HTTP Request.

The other thing that might happen is that the mail plus the attachment are bigger than 15MB and that’s what’s causing the problem. I will make further tests to verify this.

1 Like

I feel this one could be the most likely reason!

Follow-up question. Promise is the last one because this issue has been solved.

The way I make the attachment is that I make a screenshot and then I add it to the Excel file every time I make a check in a website. Obviously in the cases where there are more checks more screenshots would be taken and the size of the file would increase but, is there a way to shrink the size of the screenshots? I have seen that some of them can be as big as 1MB.

@ulises.ariza,

You can reduce the image size by this solutions.

1 Like

Thank you so much @ashokkarale

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.