使用SMTP类,而不是Outlook发送一封电子邮件,奇怪的增加邮件大小 [英] Strange increase in email size using SMTP class to send an email as opposed to outlook
问题描述
我发送一封电子邮件,附件 使用下面的code
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)
附件的文件大小为396KB,当收件人收到邮件前景 显示了文件大小为543KB。 奇怪的是,如果我发送一封电子邮件使用相同的附件使用Outlook,文件大小为 396KB。
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.
据我所知,文件大小可能增加,因为附件是基地64 EN codeD 而不仅仅是原始的二进制。
I understand that file sizes can increase due to the attachment being base 64 encoded as opposed to just raw binary.
我所没有看到的是,为什么Outlook发送一个文件,该文件是396KB大小,但在code时, 在发送,相同的文件是543KB。
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.
任何帮助将是AP preciated,并得到一个大的绿色对勾。
Any help would be appreciated and get a big green tick.
推荐答案
下面是一个猜测:Outlook可能对附件执行某种COM pression,或者可以使用更有效的编码机制比内置的 MailMessage
类一样。
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.
更新:看起来像Outlook使用专有的编码机制: http://support.microsoft.com/kb / 290809
UPDATE: Looks like Outlook uses a proprietary encoding mechanism: http://support.microsoft.com/kb/290809
这篇关于使用SMTP类,而不是Outlook发送一封电子邮件,奇怪的增加邮件大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!