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