J
Jeremy
I creating a very simple email, and attaching an excel file and trying
to send it.
When I do this with a standalone executable, everything works fine.
When I include it as part of a web service, where we're impersonating
a domain account, it corrupts the attachment. The xls file is 270Kb
on the server, but when the email is sent from the web service, the
attched file is only 300b.
Does anyone have any ideas of why this is happening ONLY when called
from a web method?
Here is the code that FAILS, inside the web service, but works when
called from a windows application...
////////////////////////////////////////////////////
MailMessage mm = new MailMessage();
mm.From = "(e-mail address removed)"; //for testing
mm.To = "(e-mail address removed)";
mm.Subject = "Subject";
mm.Body = "Body";
mm.BodyEncoding = Encoding.ASCII;
mm.BodyFormat = MailFormat.Text;
mm.Priority = MailPriority.Normal;
string strFile = @"C:\ExcelFiles\Variance Request(421).xls";
mm.Attachments.Add(new MailAttachment(strFile,
MailEncoding.UUEncode));
SmtpMail.SmtpServer = "mail.mycompany.com";
SmtpMail.Send(mm);
-Jeremy
to send it.
When I do this with a standalone executable, everything works fine.
When I include it as part of a web service, where we're impersonating
a domain account, it corrupts the attachment. The xls file is 270Kb
on the server, but when the email is sent from the web service, the
attched file is only 300b.
Does anyone have any ideas of why this is happening ONLY when called
from a web method?
Here is the code that FAILS, inside the web service, but works when
called from a windows application...
////////////////////////////////////////////////////
MailMessage mm = new MailMessage();
mm.From = "(e-mail address removed)"; //for testing
mm.To = "(e-mail address removed)";
mm.Subject = "Subject";
mm.Body = "Body";
mm.BodyEncoding = Encoding.ASCII;
mm.BodyFormat = MailFormat.Text;
mm.Priority = MailPriority.Normal;
string strFile = @"C:\ExcelFiles\Variance Request(421).xls";
mm.Attachments.Add(new MailAttachment(strFile,
MailEncoding.UUEncode));
SmtpMail.SmtpServer = "mail.mycompany.com";
SmtpMail.Send(mm);
-Jeremy