Save Email Messages from .net

I am trying to use the following example to save email messages that I am sending via vs2008 and it will save the message fine with the .msg extension but I am unable to open once created. I am getting the message that "Cannot open file:     The file may not exist, you may not have permissions to open it, or it may be open in another program. " Can anyone tell me why I cannot open the message?

http://www.codeproject.com/KB/IP/smtpclientext.aspx?display=PrintAll&fid=1533533&df=90&mpp=25&noise=3&sort=Position&view=Quick&select=2876398
earngreenAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Only1RBCommented:
Your system doesn't know what a .msg file is.  Change the extention to .txt and see if you aren't able to open it in notepad.  Or Right click on the .msg file and use "open with..." and select Notepad or Wordpad.
0
earngreenAuthor Commented:
That's correct. I can open it in notepad. The only problem with this theory is that i can save a .msg file from outlook in the same folder and open it with no problem.
0
Only1RBCommented:
Are you opeining, the file saved with outlook, with outlook or notepad.  Not sure which one you used to open it with.
0
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

earngreenAuthor Commented:
In vb, I sent one email to myself and I also saved it
with example I attached above. In outlook, I took the email
that I sent and did a save as to the same location as where
the code saved. To make sure that it was not a permissions issue. I was able to open this file without issue. I then changed the name of the offending file to txt and was able to open.  I then tried to open with outlook by using open with and it still error'd.
0
CodeCruiserCommented:
0
earngreenAuthor Commented:
Sorry. I could not get his code to work I had to upgrade to 2008 it seems there are some differences. It also seems that I can save to .eml file type and open without issue but not .msg.
0
earngreenAuthor Commented:
any ideas?
0
CodeCruiserCommented:
Are the versions of the Outlook and the Outlook Interop assembly same?
0
earngreenAuthor Commented:
I think that the problem is that I used the system.net.mail to send the email instead of the Outlook interop. Could this be the issue?
0
CodeCruiserCommented:
It may be the issue. To confirm, try using the interop.
0
earngreenAuthor Commented:
the only problem is that this will run from a server without Outlook installed. Would it be possible to use something like this to convert the message?

http://support.microsoft.com/?kbid=171907
0
earngreenAuthor Commented:
as I begin to understand what the problem is I do not think there is a solution for .net.
0
CodeCruiserCommented:
If you try this code, what format is email saved in? Is it msg or eml?

http://stackoverflow.com/questions/1264672/how-to-save-mailmessage-object-to-disk-as-eml-or-msg-file


If the Outlook wont be installed on the server, you may want to try 3rd party tools such as Aspose
http://www.aspose.com/community/blogs/aspose.network-for-.net/archive/2008/10/24/aspose-network-v4-2-0-0-supports-outlook-message-files-reading-writing.aspx
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.