I'm trying to find out how many bytes of data a PORTION of an email is taking up (not the whole email). How can I find this out?
Maybe there's something in a text editor like notepad++ that could tell me?
Drag the message from your email client to the desktop and open the resulting file (probably .EML
) in a text editor that supports different encodings and shows the size of the data (eg Notepad2). Then you can simply cut the message before and after to see the actual size of the desired block (in the status bar for Notepad2).
Notepad++ does this. Simply copy & paste the part of the message you want to size up into a new tab and read the length off the length field in the status bar at the bottom:
If you set the encoding to match your email client (Encoding menu -> UTF-8), it will count Unicode characters correctly (for example, ☃ is 3 bytes long in UTF-8 encoding).
This will only apply to plain-text emails, not to HTML or multipart/alternative emails.
Each character in the plain text should be equal to 1 byte. So 512 characters would be 0.5KB; 1024 characters would be 1KB and so forth. For example, this sample e-mail would be 308 bytes:
Date: Thu Feb 23 2012 12:00:00 -0800
From: Bob <[email protected]>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:8.0) Gecko/20111105 Thunderbird/8.0
MIME-Version: 1.0
To: [email protected]
Subject: Test
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
This is a test message
Edit: To clarify, "one character" refers to the raw source of the e-mail message, not the formatted representation shown by most e-mail clients. The original question refers specifically to plain text and to Notepad++ (which has ANSI as its default encoding) so I assumed that the message would be encoded as plain ANSI.
To get a good estimate, one thing you can do is copy and paste the text to a .txt file and then read the resulting file size. I've written an AutoHotkey script to make it a little easier. Press Win+C to have a little popup message display the file size of the selected text.
#c:: ;[Win]+[C]
{
OriginalClipboard := Clipboard
Clipboard =
Send, ^c
ClipWait
FileAppend, %Clipboard%, temp.txt
Clipboard =
Clipboard := OriginalClipboard
ClipWait
FileGetSize, fileSize, temp.txt
MsgBox, , , Bytes: %fileSize%
FileDelete, temp.txt
return
}
Meta: my answer above is about 600
bytes.
If you are sending your email as plain text then the number of bytes will be roughly equal to the number of characters in the selected text. If you paste the text into Microsoft Word it will be able to do a letter count for you to help.
If you are sending your email as Rich Text or HTML then there is no easy formula. In general the longer and the more complicated the formatting of the text is, the larger it will be in bytes.
If it really matters that you reduce the size of your email, always use plain text encoding.
wc
- does it not?