Received : 2007/11/23 15:56:08
Message : When I save to a stream, then try to attach to an email, I receive the email, but the attachment is empty. Could you please help? I've tried everything, but I cannot get this to work. Thank you kindly for your assistance. Here's the pertinent excerpt from my code:
System.IO.MemoryStream s = new System.IO.MemoryStream();
workbook.Save(s, FileFormatType.Default)
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
msg.To.Add(strMailTo);
msg.From = new MailAddress(strMailFrom);
msg.Subject = "Test email";
msg.Body = "Test email with attached report";
msg.Attachments.Add(new Attachment(s, "report.xls", "application/vnd.ms-excel"));
SmtpClient smtp = new SmtpClient(strSmtpServer);
smtp.Credentials = new System.Net.NetworkCredential(strUserName, strPassword);
smtp.Send(msg);
This message was posted using Aspose.Live 2 Forum