Re: Using SMPTMail, MailAttachment corrupts the attachment when called from a web service
From: Morten Abrahamsen (morten.abrahamsen_at_gmail.com)
Date: 09/16/04
- Next message: jeremy halbert: "Re: Using SMPTMail, MailAttachment corrupts the attachment when called from a web service"
- Previous message: Girish Bharadwaj: "Re: xml payload to webservice"
- In reply to: Jeremy: "Using SMPTMail, MailAttachment corrupts the attachment when called from a web service"
- Next in thread: jeremy halbert: "Re: Using SMPTMail, MailAttachment corrupts the attachment when called from a web service"
- Reply: jeremy halbert: "Re: Using SMPTMail, MailAttachment corrupts the attachment when called from a web service"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 17 Sep 2004 00:03:25 +0200
This might be a long shot, but since we're working in two different
security contexts;
Does the ASP.NET account (or whatever account your WebService is using)
have access to the file ?
Morty
Jeremy wrote:
> 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 = "jeremyh@mycompany.com"; //for testing
> mm.To = "jeremyh@mycompany.com";
> 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
- Next message: jeremy halbert: "Re: Using SMPTMail, MailAttachment corrupts the attachment when called from a web service"
- Previous message: Girish Bharadwaj: "Re: xml payload to webservice"
- In reply to: Jeremy: "Using SMPTMail, MailAttachment corrupts the attachment when called from a web service"
- Next in thread: jeremy halbert: "Re: Using SMPTMail, MailAttachment corrupts the attachment when called from a web service"
- Reply: jeremy halbert: "Re: Using SMPTMail, MailAttachment corrupts the attachment when called from a web service"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|