Exchange Outlook and SMTP with c#

S

Sachin

Hello All,

I am working on an service application to send an emails from exchange server.

I want to use the groups created in the exchange server to send the mail.

At present I am using the following code to send the emails

CDO.Message oMsg = new CDO.Message();
CDO.IConfiguration iConfg;
iConfg = oMsg.Configuration;
ADODB.Fields oFields;
oFields = iConfg.Fields;
ADODB.Field oField =
oFields["http://schemas.microsoft.com/cdo/configuration/sendusing"];
oField.Value = 2;
oFields.Update();
oField =
oFields["http://schemas.microsoft.com/cdo/configuration/smtpserver"];
//Exchannge server
oField.Value = "xxx.xxx.com";
oFields.Update();

oField =
oFields["http://schemas.microsoft.com/cdo/configuration/smtpserverport"];
oField.Value = 25;
oFields.Update();

oField =
oFields["http://schemas.microsoft.com/cdo/configuration/smtpaccountname"];
oField.Value = "(e-mail address removed)";
oFields.Update();

oField =
oFields["http://schemas.microsoft.com/cdo/configuration/sendemailaddress"];
oField.Value = "(e-mail address removed)";
oFields.Update();

oField =
oFields["http://schemas.microsoft.com/cdo/configuration/smtpuserreplyemailaddress"];
oField.Value = "(e-mail address removed)";
oFields.Update();


oField =
oFields["http://schemas.microsoft.com/cdo/configuration/sendusername"];
//My domain and username
oField.Value = @"xxx\xxxx";
oFields.Update();

oField =
oFields["http://schemas.microsoft.com/cdo/configuration/sendpassword"];
//my password
oField.Value = "xxxxx";
oFields.Update();

oMsg.TextBody = "Hello, how are you doing?";
oMsg.From = "(e-mail address removed)";
oMsg.To = "(e-mail address removed)";
oMsg.Send();

I am successful when I send a mail to email account.

But there is an error when I refer a group.

Another problem I am facing is I want to see the mail in sent mails of
microsoft outlook. Can it be done?

I am using outlook 2003 and exchange 2003 server with C#.

Its very urgent please let me know.

Sachin
 

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