I am sending an email with an attachment using the following Code
Dim msg As New System.Net.Mail.MailMessage(req.EmailFrom, req.EmailTo)
Dim att As New System.Net.Mail.Attachment("C:\Documents and Settings\michaelr\Desktop\1216259.pdf")
With msg
.Attachments.Add(att)
.Body = req.EmailBody
.Subject = req.EmailSubject
End With
Dim client As New System.Net.Mail.SmtpClient()
client.Host = PDFService(Of T).mSMTPServer
client.Send(msg)
The file size of the attachment is 396KB, upon the recipient receiving the email outlook shows the file size as 543Kb. Strange thing is if I send an email with the same attachment using outlook the file size is 396Kb.
I understand that file sizes can increase due to the attachment being base 64 encoded as opposed to just raw binary.
What I am failing to see is why outlook send a file which is 396KB in size but in code when sending it, the same file is 543Kb.
Any help would be appreciated and get a big green tic开发者_JS百科k.
This increase looks like an overhead of MIME encoding to me
Here's a guess: Outlook may perform some kind of compression on the attachment, or may use a more efficient encoding mechanism than the built-in MailMessage
class does.
UPDATE: Looks like Outlook uses a proprietary encoding mechanism: http://support.microsoft.com/kb/290809
精彩评论