How to convert eml file to msg file using vc++



Dear Experts ,

I am developing an application that need to converts eml file to msg
file using VC++ 6.0

Right now i am using redemption.dll for this conversion and it works
fine .

My problem is when Microsoft OutLook is configured with Exchange then
while converting

application ask for username / password . But it never ask for login if
the account is POP3 .

////////////////////////////////////// CODE :


Redemption::ISafeMailItemPtr pMailItem("Redemption.SafeMailItem");

_ApplicationPtr pOutlook = NULL;
_NameSpacePtr pMAPI = NULL;

_MailItemPtr pM = NULL;
_MailItemPtr spMail = NULL;


pMAPI = pOutlook->GetNamespace("MAPI");

pMAPI->Logon("","",false ,true); // ASK for Login
if User is Exchange esle works fine.

bstr_t bstrPath("c:\\files\\1.eml");

pM = pOutlook->CreateItem(olMailItem);

pMailItem->Item = pM;


bstr_t bstrMsgPath("c:\\files\\z.msg");

pMailItem->raw_SaveAs(bstrMsgPath,_variant_t((long)3)); // 3=msg


AfxMessageBox("Msg File Created");


This works fine when outlook is open in case of Exchange user . I mean
to say Application never ask for user login when outlook is kept open
..otherwise it ask for login .

Please help me regarding this

Thanks in Advance

Jignesh Patel



Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question