Outlook Problem send mail automatically in C# using Outlook redemption

Joined
Oct 21, 2009
Messages
1
Reaction score
0
Hi,

I'm trying to send mail automatically through an console application using Outlook redemption.
I'm using Outlook 2003. I'm trying to send a mail from the account that is configured in the Exchange server.
The following code works perfect when my outlook is running. But when i close the outlook i'm not able to send the mail automatically.
There are 2 profiles configured in my machine. Even when i give the Profile name and password in the Logon method,it still prompts for the entering the password when my MS outlook is closed and not running.

Please look into my below code and help me to figure out my mistake. I'm trying to send the mail even wen my outlook is not running in my machine. Is that possible.if so suggest.

Outlook.Application objMsOutLook = new Outlook.ApplicationClass();
Outlook.NameSpace objMsOLNamespace = objMsOutLook.GetNamespace("MAPI");
objMsOLNamespace.Logon("MAIL", "october@2009", false, false);
SafeMailItem sItem = new Redemption.SafeMailItem();
Outlook.MailItem olItem = objMsOutLook.CreateItem(0) as Outlook.MailItem;
sItem.Item = olItem;
sItem.Recipients.Add("(e-mail address removed)");
sItem.Recipients.ResolveAll();
sItem.Body="Hi Team, \n\n\t" + " + "Thanks \n ";
sItem.Send();
Thanks,
Archana
 

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

Top