[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Save Email Messages from .net

Posted on 2010-03-26
13
Medium Priority
?
343 Views
Last Modified: 2013-11-26
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
0
Comment
Question by:earngreen
  • 7
  • 4
  • 2
13 Comments
 
LVL 2

Expert Comment

by:Only1RB
ID: 28745494
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
 

Author Comment

by:earngreen
ID: 28781706
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
 
LVL 2

Expert Comment

by:Only1RB
ID: 28795620
Are you opeining, the file saved with outlook, with outlook or notepad.  Not sure which one you used to open it with.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Comment

by:earngreen
ID: 28803115
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
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 28809900
0
 

Author Comment

by:earngreen
ID: 29007361
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
 

Author Comment

by:earngreen
ID: 29222983
any ideas?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 29223903
Are the versions of the Outlook and the Outlook Interop assembly same?
0
 

Author Comment

by:earngreen
ID: 29230596
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
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 29231740
It may be the issue. To confirm, try using the interop.
0
 

Author Comment

by:earngreen
ID: 29233079
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
 

Author Comment

by:earngreen
ID: 29236290
as I begin to understand what the problem is I do not think there is a solution for .net.
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 2000 total points
ID: 29317848
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

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Hi, this video explains a free download that you can incorporate into your Access databases, or use stand-alone for contact management. Contacts -- Names, Addresses, Phone Numbers, eMail Addresses, Websites, Lists, Projects, Notes, Attachments…
Get the source code for a fully functional Access application shell with several popular security features that Access VBA application developers desire, but find difficult or impossible to figure out how to code. You get the source code for managi…
Suggested Courses

607 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question