Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7935695
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T22:00:11+00:00 2026-06-03T22:00:11+00:00

I am using the Indy TIdSmtp component to send E-mails. The E-mails I am

  • 0

I am using the Indy TIdSmtp component to send E-mails. The E-mails I am sending will have a large attachment, usually in the range of 5 to 40 MB. I want to update a progress bar that will show the overall progress of the send as a percentage of the total number of bytes that need to be sent. I don’t care if it’s really precise, just good enough to give someone watching the progress bar an indication for how far along the overall E-mail sending process is.

Can someone point me to a code sample that shows me how to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T22:00:13+00:00Added an answer on June 3, 2026 at 10:00 pm

    TIdSMTP encodes the email on-the-fly as it is being sent to the server. The total number of bytes being sent is not known ahead of time. The only way you would be able to determine a value even reasonably close is to encode the email to a temporary TStream via the TIdMessage.SaveToStream() method and then grab the value of the TStream.Size property. Since you are encoding large attachments, that will take some time and lots of memory overhead. Since TIdSMTP will just re-encode the email again during transmission, there is no guarantee that the number of bytes actually transmitted will match the temp TStream.Size due to the dynamic nature of various email headers, such as timestamps and MIME boundaries.

    To determine how many bytes are actually being sent, use the TIdSMTP.OnWork... events, where the AWorkMode parameter will be set to wmWrite. Since TIdSMTP.Send() does not know ahead of time how many bytes it will be sending, the AWorkCountMax parameter of the TIdSMTP.OnWorkBegin event will be 0, but at least you will know when the actual email data begin encoding/sending (after TIdSMTP has exchanged several commands with the server). The AWorkCount parameter of the TIdSMTP.OnWork event will be the total number of bytes actually sent. When the TIdSMTP.OnWorkEnd event is fired, the email has finished being sent.

    Based on the temp TStream.Size property and the AWorkCount parameter of the TIdSMTP.OnWork event, you will be able to display an approximation of a percentage for a progress bar. It will not be guaranteed to be 100% accurate, but it will be close.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have built a simple website monitoring application using Indy TIdhttp component. I want
I am sending e-mails using the indy components TidSMTP and TidMessage . The mails
My apps send emails using the Indy TiDSMTP client component. In some situations however,
I want to send email to Yahoo mail using Indy. But Yahoo uses 465
I'm using Delphi 2009 and the lastest Indy 10 from svn to send e-mails
I want to send some binary data over via GET using the Indy components.
I am using indy's http server for a project so i have a few
I'm using the IdFTP (Indy 10) component to download some files (zip and txt)
I am trying to send an e-mail using gmail account (Delphi 7, Indy 10)
I have been using Indy to transfers files via FTP for years now but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.