Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

System.Net.Mail MailMessage - detecting email size

Status
Not open for further replies.

huggyboy

Programmer
Feb 7, 2003
108
GB
I have written a VB.Net program which generates emails via SmtpClient creating a mailmessage with a html formatted body with no attachments.
All OK so far.
However I would like to detect in the code what the size of the generated email message is - Mailmessage class doesnt seem to have a size property.
Anybody have any ideas?
Just for interest I counted the number of characters in each email body and (rounding up to the nearest K) seemed to be either 4 or 5K less than the size shown in Outlook when i receive them, so it seems i can make an approximation.

Thanks in anticipation.
 
Some Kludge ideas:
Could you send a copy of the email to yourself and figure out the size from that. (I suspect that you want the size before sending thou, so this idea will not work.)

If doing an approximate is needed/used, you may want to improve the approx by sending a number of test files with 1, 10, 100, 1000 etc characters. This way you will have a number of data points to make a much better approx.

Lion Crest Software Services
Anthony L. Testi
President
 
Thanks for your input.

My calculations on the email size was a first attempt/experiment - I will do it more rigorously (as you suggest) if there is no other way.

H

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top