469,609 Members | 2,241 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,609 developers. It's quick & easy.

Exchange Sending Mail

Gaz
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 =
so*******@something.com;
config.Fields[CDO.CdoConfiguration.cdoSendEmailAddress].Value =
so*******@something.com;
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 = me@j-media.com;
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.

--
It''s all fun and games until someone loses an eye, then it''s just fun and
games that you can''t see!
Nov 17 '05 #1
2 10842
Why not just use System.Web.Mail namespace to send mail to the exchange
server?

http://msdn.microsoft.com/library/de...temwebmail.asp

HTH

Ollie Riches

"Gaz" <Ga*@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
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 =
so*******@something.com;
config.Fields[CDO.CdoConfiguration.cdoSendEmailAddress].Value =
so*******@something.com;
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 = me@j-media.com;
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.

--
It''s all fun and games until someone loses an eye, then it''s just fun
and
games that you can''t see!

Nov 17 '05 #2
Gaz
I want the mail to drop into the sent items of a certain users mailbox, hence
the reason for sending via exchange and not just smtp.
--
It''''''''s all fun and games until someone loses an eye, then it''''''''s
just fun and games that you can''''''''t see!
"Ollie Riches" wrote:
Why not just use System.Web.Mail namespace to send mail to the exchange
server?

http://msdn.microsoft.com/library/de...temwebmail.asp

HTH

Ollie Riches

"Gaz" <Ga*@discussions.microsoft.com> wrote in message
news:50**********************************@microsof t.com...
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 =
so*******@something.com;
config.Fields[CDO.CdoConfiguration.cdoSendEmailAddress].Value =
so*******@something.com;
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 = me@j-media.com;
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.

--
It''s all fun and games until someone loses an eye, then it''s just fun
and
games that you can''t see!


Nov 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Gilbert Cheung | last post: by
8 posts views Thread by Michel Posseth [MCP] | last post: by
reply views Thread by Solution2021 | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.