Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Use perl to create outlook .msg file

by aravinds (Initiate)
on Jan 07, 2012 at 03:24 UTC ( #946708=perlquestion: print w/ replies, xml ) Need Help??
aravinds has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I am using perl on windows and would like to know how to create an outlook email file (.msg)?

Essentially, what I need to create is a file exactly equal to one created by this process:
1. You compose an email in outlook
2. Add To, CC, Subject, HTML Body and do not send it yet but save it as a .msg file on hard-drive.
3. When you open the .msg file from your hard-drive, it automatically opens the email in edit mode and its ready for you to review/send.

Now, I have already written another perl program which auto generates the To,CC,Subject and HTML Body of the email. I need to know how to use PERL to create a .msg file with this information in it, on the hard-drive. I do not want PERL to actually send the message - it just has to create this editable .msg file.

The reason I don't want to send the email but rather create a .msg file is because the system in which these perl programs run does not have outlook configured (cannot be configured due to firewall/designed to not be able to access Exchange Server, although Outlook is installed on this system) and therefore I need PERL to just create the .msg file which I can copy over to another system where I can just open it in Outlook installed there and review it/send it.

I have already looked at other Outlook related posts in perlmonks but did not find one dealing with just creating a msg file as opposed to actually sending the email.

Appreciate if you can help

Thanks

Comment on Use perl to create outlook .msg file
Re: Use perl to create outlook .msg file
by Anonymous Monk on Jan 07, 2012 at 03:53 UTC
      Hi Anonymous Monk,

      Thanks for your time.

      $message->save; saves it in the Drafts folder within Outlook, but I need the program to create a file on the harddrive as a physical file (.msg).

      Did not find any useful code snippets on the duckduckgo search engine either.

        Um, go to MSDN, find the message object , look for save, save_to, etc, etc

        The solution is: $message->SaveAs('C:\test.msg');

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://946708]
Approved by planetscape
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (9)
As of 2014-07-24 21:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (167 votes), past polls