Hi

I am using .net 1.1 to send an email with a .ics attachent. However my
code keeps failing silently (that is, no exceptions or errors in the
event log, but no email recieved either).

If I comment out the line that add the attachment, the mail sends
fine.

If I point the attachment to a .txt file on the file system, it gets
attached and recieved.

If I then change the same file's extension to .ics and send again the
email never gets recieved.

If I point it to a .pdf, the email never gets recieved.

The weird thing is - this code works in a virtual PC but not on my
production server. So I am looking at a configuration option in IIS
SMTP being out of whack.

I copied my code into a simple web form to test it. This is what it
looks like:

[code]
try
{
System.Web.Mail.MailMessage objMsg = new
System.Web.Mail.MailMessage();
System.Web.Mail.MailAttachment objAttachment;
object strFrom = "";
object strEmail = "";
object strSubject = "";
object strBody = "";
object strAttachmentPath = "";
System.Web.Mail.SmtpMail.SmtpServer = "192.168.1.17";
strFrom = "emeetings@eshareuk.com";

strSubject = "You have been granted access to an eMeeting...";
strBody = "This is an automated email";
strAttachmentPath = TextBox1.Text.ToString();
objMsg.From = strFrom.ToString();
objMsg.Subject = strSubject.ToString();
objMsg.Body = strBody.ToString();
objMsg.To = "richard@enerzy.co.uk";
objMsg.Subject = strSubject.ToString();
objMsg.Body = strBody.ToString();
objAttachment = new
System.Web.Mail.MailAttachment(strAttachmentPath.ToString());
objMsg.Attachments.Add(objAttachment);
System.Web.Mail.SmtpMail.Send(objMsg);
}
catch (Exception ex)
{
Response.Write(ex.Message.ToString());
}
[/code]

Any help or thoughts would be very much appreciated.

Kind regards, Rich

Re: problem with some file types - mail attachment by Steve

Steve
Thu May 10 20:52:24 CDT 2007

Sounds like an encoding issue. Try changing how it is encoded.
http://weblogs.asp.net/steveschofield/archive/2007/01/23/system-web-mail-and-pdf-getting-corrupted-workaround.aspx

--

Thank you,

Steve Schofield
Windows Server MVP - IIS
ASPInsider Member - MCP

http://www.orcsweb.com/
Managed Complex Hosting
#1 in Service and Support

<richard.markiewicz@eshareuk.com> wrote in message
news:1178793356.028193.31130@e65g2000hsc.googlegroups.com...
> Hi
>
> I am using .net 1.1 to send an email with a .ics attachent. However my
> code keeps failing silently (that is, no exceptions or errors in the
> event log, but no email recieved either).
>
> If I comment out the line that add the attachment, the mail sends
> fine.
>
> If I point the attachment to a .txt file on the file system, it gets
> attached and recieved.
>
> If I then change the same file's extension to .ics and send again the
> email never gets recieved.
>
> If I point it to a .pdf, the email never gets recieved.
>
> The weird thing is - this code works in a virtual PC but not on my
> production server. So I am looking at a configuration option in IIS
> SMTP being out of whack.
>
> I copied my code into a simple web form to test it. This is what it
> looks like:
>
> [code]
> try
> {
> System.Web.Mail.MailMessage objMsg = new
> System.Web.Mail.MailMessage();
> System.Web.Mail.MailAttachment objAttachment;
> object strFrom = "";
> object strEmail = "";
> object strSubject = "";
> object strBody = "";
> object strAttachmentPath = "";
> System.Web.Mail.SmtpMail.SmtpServer = "192.168.1.17";
> strFrom = "emeetings@eshareuk.com";
>
> strSubject = "You have been granted access to an eMeeting...";
> strBody = "This is an automated email";
> strAttachmentPath = TextBox1.Text.ToString();
> objMsg.From = strFrom.ToString();
> objMsg.Subject = strSubject.ToString();
> objMsg.Body = strBody.ToString();
> objMsg.To = "richard@enerzy.co.uk";
> objMsg.Subject = strSubject.ToString();
> objMsg.Body = strBody.ToString();
> objAttachment = new
> System.Web.Mail.MailAttachment(strAttachmentPath.ToString());
> objMsg.Attachments.Add(objAttachment);
> System.Web.Mail.SmtpMail.Send(objMsg);
> }
> catch (Exception ex)
> {
> Response.Write(ex.Message.ToString());
> }
> [/code]
>
> Any help or thoughts would be very much appreciated.
>
> Kind regards, Rich
>


Re: problem with some file types - mail attachment by richard

richard
Fri May 11 03:14:41 CDT 2007

Hi Steve

Thanks for taking the time, I appreciate it.

I have tried changing the encoding to UUEncode and Base64 however
neither has any effect.

The email with ics or pdf attachment simply doesn't get sent... There
appears to be no record in the SMTP log (although I can't really read
the damn thing!).

Although attaching a txt file does work...

Do you have any other thoughts?

Many thanks, Rich


Re: problem with some file types - mail attachment by Steve

Steve
Fri May 11 06:52:29 CDT 2007

Try adjusting the size allowed in the SMTP settings. Also verify the MIME
type is defined, that is another thing I can suggest. I can't think of why
an ICS extension would get dropped. Are you running some type of Anti-virus
on the box?

Here is another thought, manually write a VBS file and attach the file. If
it works on the server, then it is something related to IIS or SMTP
settings. Hope that helps provide some direction.

--

Thank you,

Steve Schofield
Windows Server MVP - IIS
ASPInsider Member - MCP

http://www.orcsweb.com/
Managed Complex Hosting
#1 in Service and Support

<richard.markiewicz@eshareuk.com> wrote in message
news:1178871281.565260.254240@e65g2000hsc.googlegroups.com...
> Hi Steve
>
> Thanks for taking the time, I appreciate it.
>
> I have tried changing the encoding to UUEncode and Base64 however
> neither has any effect.
>
> The email with ics or pdf attachment simply doesn't get sent... There
> appears to be no record in the SMTP log (although I can't really read
> the damn thing!).
>
> Although attaching a txt file does work...
>
> Do you have any other thoughts?
>
> Many thanks, Rich
>


Re: problem with some file types - mail attachment by richard

richard
Sat May 12 07:04:37 CDT 2007

Hi Steve

I really appreciate your continued advice.

Our production server was not limiting the size on email, but our
development pc was... That was the only difference I could actually
see between the two configurations. So I adjusted them to match and no
change.

I checked and ICS is registered as a MIME type.

Also, there is not anti virus on the server. We do have an unified
hardware firewall that provides AV, etc... This was my first suspect
however I have ascertained that out-going traffic is not filtered in
any way, only inbound traffic so I have ruled that out.

Interestingly I spun my code out into a seperate application and
testing has shown that .txt and .zip get attached and email fine. .ics
and .pdf never arrive and nothing is logged.

I think it's fairly certain this is a configuraiton issue but the IIS
SMTP options are basic enough that I don't really see where we can be
going wrong... A conversation with a colleague reveals that a previous
version of our corporate website used to send emails with PDF
attachments with no problems.

Given my lack of experience with SMTP and the strange nature of the
issue I've decided to elevate the problem to the IIS support team.
When we reach a resolution I will post it here in case anyone else
encounters this.

Thanks again for the help and ideas.

Rich


Re: problem with some file types - mail attachment by Steve

Steve
Sun May 13 02:32:11 CDT 2007

Based on what you are describing, it appears one of the servers delivering
email in your environment is blocking or stripping these attachments. Good
luck finding the root cause.

--

Thank you,

Steve Schofield
Windows Server MVP - IIS
ASPInsider Member - MCP

http://www.orcsweb.com/
Managed Complex Hosting
#1 in Service and Support

<richard.markiewicz@eshareuk.com> wrote in message
news:1178971477.059588.138350@p77g2000hsh.googlegroups.com...
> Hi Steve
>
> I really appreciate your continued advice.
>
> Our production server was not limiting the size on email, but our
> development pc was... That was the only difference I could actually
> see between the two configurations. So I adjusted them to match and no
> change.
>
> I checked and ICS is registered as a MIME type.
>
> Also, there is not anti virus on the server. We do have an unified
> hardware firewall that provides AV, etc... This was my first suspect
> however I have ascertained that out-going traffic is not filtered in
> any way, only inbound traffic so I have ruled that out.
>
> Interestingly I spun my code out into a seperate application and
> testing has shown that .txt and .zip get attached and email fine. .ics
> and .pdf never arrive and nothing is logged.
>
> I think it's fairly certain this is a configuraiton issue but the IIS
> SMTP options are basic enough that I don't really see where we can be
> going wrong... A conversation with a colleague reveals that a previous
> version of our corporate website used to send emails with PDF
> attachments with no problems.
>
> Given my lack of experience with SMTP and the strange nature of the
> issue I've decided to elevate the problem to the IIS support team.
> When we reach a resolution I will post it here in case anyone else
> encounters this.
>
> Thanks again for the help and ideas.
>
> Rich
>


Re: problem with some file types - mail attachment by richard

richard
Tue May 29 11:36:27 CDT 2007

It was a rogue event sink on the SMTP server.....

Oh well!

Thanks, Richard