System.Web.Mail FAQ

Complete FAQ Listing


4.3.7 The specified protocol is unknown. Part 2 Printer Friendly   Email This FAQ   Discuss

If you are getting this error, and you are adding attachments, you might be adding them incorrectly. You can only create a MailAttachment by specifying an absolute path.

For example, if you are doing something like:

MailAttachment a = new MailAttachment( "test.txt" );
m.Attachments.Add( a );

You will instead, need to explicitly specify the path. So try

MailAttachment a = new MailAttachment( Server.MapPath( "test.txt" ) ); //if this is an ASP.NET app
m.Attachments.Add( a );

or, from a console/winform app try

MailAttachment a = new MailAttachment( "c:\\test.txt" );
m.Attachments.Add( a );
 

Discuss This FAQ Item
Got a question? Another Suggestion? Want to post your solution? Discuss it below.
New Post
  • RE: The specified protocol is unknown. Part 2    [ Reply ]
    • RE RE: The specified protocol is unknown. Part 2    [ Reply ]
  • Thanks    [ Reply ]