G
Guest
Hi all
I am currently trying to send and email via exchange except I'm having a
nightmare getting it working, you'd think this would be pertty simple
wouldn't you?
I have added a reference to cdoex.dll in my project and this is my code:
ADODB.ConnectionClass conn = null;
CDO.MessageClass msg = new CDO.MessageClass();C
CDO.ConfigurationClass config = new CDO.ConfigurationClass();
conn = new ADODB.ConnectionClass();
conn.Provider = "MSDAIPP.DSO.1";
conn.Open("http://servername/exchange/mailboxname", "username", "password",
-1);
config.Fields[CDO.CdoConfiguration.cdoSendUserReplyEmailAddress].Value =
(e-mail address removed);
config.Fields[CDO.CdoConfiguration.cdoSendEmailAddress].Value =
(e-mail address removed);
config.Fields[CDO.CdoConfiguration.cdoSendUserName].Value = "username";
config.Fields[CDO.CdoConfiguration.cdoSendPassword].Value = "password";
config.Fields[CDO.CdoConfiguration.cdoSendUsingMethod].Value =
CDO.CdoSendUsing.cdoSendUsingExchange;
config.Fields[CDO.CdoConfiguration.cdoMailboxURL].Value =
"http://servername/exchange/mailboxname";
config.Fields[CDO.CdoConfiguration.cdoActiveConnection].Value = conn;
config.Fields.Update();
msg.Configuration = config;
msg.To = (e-mail address removed);
msg.Subject = "tester";
msg.TextBody = "saf";
msg.Send();
When I run this code i receive an "Unspecified Error" which of course helps
no end in solving the issue.
Anyone any ideas or code snippets they would like to share with me about
sending mails with attachments via an exchange account.
I am currently trying to send and email via exchange except I'm having a
nightmare getting it working, you'd think this would be pertty simple
wouldn't you?
I have added a reference to cdoex.dll in my project and this is my code:
ADODB.ConnectionClass conn = null;
CDO.MessageClass msg = new CDO.MessageClass();C
CDO.ConfigurationClass config = new CDO.ConfigurationClass();
conn = new ADODB.ConnectionClass();
conn.Provider = "MSDAIPP.DSO.1";
conn.Open("http://servername/exchange/mailboxname", "username", "password",
-1);
config.Fields[CDO.CdoConfiguration.cdoSendUserReplyEmailAddress].Value =
(e-mail address removed);
config.Fields[CDO.CdoConfiguration.cdoSendEmailAddress].Value =
(e-mail address removed);
config.Fields[CDO.CdoConfiguration.cdoSendUserName].Value = "username";
config.Fields[CDO.CdoConfiguration.cdoSendPassword].Value = "password";
config.Fields[CDO.CdoConfiguration.cdoSendUsingMethod].Value =
CDO.CdoSendUsing.cdoSendUsingExchange;
config.Fields[CDO.CdoConfiguration.cdoMailboxURL].Value =
"http://servername/exchange/mailboxname";
config.Fields[CDO.CdoConfiguration.cdoActiveConnection].Value = conn;
config.Fields.Update();
msg.Configuration = config;
msg.To = (e-mail address removed);
msg.Subject = "tester";
msg.TextBody = "saf";
msg.Send();
When I run this code i receive an "Unspecified Error" which of course helps
no end in solving the issue.
Anyone any ideas or code snippets they would like to share with me about
sending mails with attachments via an exchange account.