Connecting Tech Pros Worldwide Help | Site Map

determining MailMessage size with LinkedResources

Newbie
 
Join Date: Oct 2008
Posts: 2
#1: Oct 24 '08
Is there a .NET method that will tell me the size of a MailMessage (that could contain several LinkedResources)? And if there's no native method (which I assume is the case), is there an accepted way to determine the size manually?

I am sending emails using SmtpClient.Send() and need to know if a message exceeds a given size.

Thanks.

-Steve
Plater's Avatar
Moderator
 
Join Date: Apr 2007
Location: New England
Posts: 7,150
#2: Oct 24 '08

re: determining MailMessage size with LinkedResources


Hmmm. You might be able to get pretty close by looking at the Length fo the stream in the Linkedresource. .ContentStream.Length ?
Newbie
 
Join Date: Oct 2008
Posts: 2
#3: Oct 24 '08

re: determining MailMessage size with LinkedResources


That does appear to get me what I need for the actual resources itself. Thanks.

That (obviously) doesn't take into account the text in the body of the email, the header, etc. I tried calculating the length of each of those, but I'm still coming up short from what Outlook is claiming.

It could be that Outlook is attaching some of its own overhead and skewing the numbers...I just don't know.

-Steve
Reply