

.
MemoryStream attStream = new MemoryStream();
attStream.Write(mailAttachment,0,mailAttachment.Length);
Attachment objAttachment = new Attachment(attStream,mailAttachmentName);


.
objSmtp.SendMail(objMail);结果.....死活附件发送不出去,也没有任何异常产生,跟踪进入OpenSmtp.Mail.MailEncoder.ConvertToBase64()
internal static void ConvertToBase64(Stream inputStream, string outputFilePath)
{
...............
//Read from the input file, then encrypt and write to the output file.
while(rdlen < totlen)
{
len = inputStream.Read(bin, 0, (int)inputStream.Length);
encStream.Write(bin, 0, len);
//inputBlock size(3)
rdlen = (rdlen + ((len / transformer.InputBlockSize) * transformer.OutputBlockSize));
}
encStream.Close();
fout.Close();
}

MemoryStream attStream = new MemoryStream();
attStream.Write(mailAttachment,0,mailAttachment.Length);
attStream.Seek(0,SeekOrigin.Begin);
Attachment objAttachment = new Attachment(attStream,mailAttachmentName);
.
objSmtp.SendMail(objMail);二进制附件正常 ^^

浙公网安备 33010602011771号