attachment file size

SriRaghavendran Prabhakaran 320 Reputation points
2025-02-03T17:47:01.9266667+00:00

Hello,

I have a requirement to send email with SMTP connector in logic app, and the email can have multiple attachments (count of 7 to 10 ). I need to have validation to check file size of all (sum of attachments) attachments that should not exit a mandatory limit of email. could you please help me a way to check file size?

thanks,

Sri

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
3,335 questions
{count} votes

Accepted answer
  1. Shireesha Eeraboina 1,390 Reputation points Microsoft Vendor
    2025-02-05T10:02:59.5866667+00:00

    Hi @SriRaghavendran Prabhakaran ,

    Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    To validate the total file size of multiple attachments before sending an email using the SMTP connector in Azure Logic Apps, follow these steps:

    • Use the appropriate email connector to obtain the email attachments. If the files are sourced from an HTTP request or another system, look for a property like "Content-Length" that indicates the size of each attachment.
    • Create a variable to maintain a running total of the attachment sizes, initializing it to 0.
    • Implement a For Each loop to iterate through each attachment. Within this loop, retrieve the size of each attachment and add it to the running total variable.
    • After the loop, add a step to check the total size against your predefined limit. If the total size exceeds this limit, take appropriate action, such as sending an error message or preventing the email from being sent.
    • If the total size is within the acceptable limit, proceed to send the email with the attachments.

    If you encounter issues while summing the file sizes, ensure that you are accurately retrieving the size for each attachment and that your variable is being updated correctly within the loop.

    For your reference, please review the following documentation for further clarification."

    I hope this helps! Let me know if you have any further questions or need additional assistance.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.