Discussion:
Problem in sending mail using CDO
(too old to reply)
Cor Ligthert [MVP]
2005-08-22 06:57:13 UTC
Permalink
Devesh,

Mostly is the problem in this that the mailserver is not functioning.

Why don't you not make a simple program withouth everything not needed to
test that, ore just use an ip address of a smtp server from which you are
sure.

I would go for my first idea.

(I have nowhere seen that the smptp server throws exceptions so trying to
catch those when that is not done (I am not sure of that) will not help
much)

I hope this helps,

Cor
Ken Tucker [MVP]
2005-08-22 09:41:56 UTC
Permalink
Hi,

You can use indy to send mail through the persons pop3 mail account.
www.onteorasoftware.com/downloads/indysendmail.zip

http://www.indyproject.org/

Ken
--------------------------
"Devesh Aggarwal" <***@unieme.com> wrote in message news:***@TK2MSFTNGP14.phx.gbl...
I am trying to send mail using CDO. The mail gets generated & goes in
outbox. In case of POP3 account it even goes from the outbox but the
recipient never receives the mail. I am attaching the code snippet for
reference.

I am not sure which is the right newsgroup for such query so i am posting in
outlook as well as dotnet.

Any suggestions.

Devesh Aggarwal
Dan Mitchell
2005-08-22 18:11:33 UTC
Permalink
Post by Ken Tucker [MVP]
I am trying to send mail using CDO. The mail gets generated & goes in
outbox. In case of POP3 account it even goes from the outbox but the
recipient never receives the mail. I am attaching the code snippet for
reference.
Restricting followup groups a bit:

First, do you get any bounce back?

Second, .net and CDO1.21 don't work together -- see
http://support.microsoft.com/default.aspx?scid=kb;en-us;813349

Third, are you sure that the recipient doesn't have spam filtering that
might be eating the message?

Fourth, you aren't resolving the recipient, which will cause problems.
Don't forget to put "smtp:" in front of their address, too.

Fifth, you have commented out code to try and set the from address --
too save you some time, that's not how that code works, you can't just
arbitrarily set from: addresses when sending through Exchange Server via
MAPI/CDO, it will authenticate you as the user, and make sure that
you're sending as a user that you're allowed to send on behalf of. If
you need to set a from: address that can be absolutely anything
(***@heaven.com, whatever), you'll have to use raw SMTP, which isn't
authenticated.

Sixth, are you running this code on a PC that has Outlook installed to
get CDO1.21? If so, then are you hitting the security dialog, and if so,
what are you doing about it? If you have this code running behind a web
page or something, there'll be different problems -- see
http://www.outlookcode.com/d/sec.htm for more.

Seventh, here's a minimal sample, to avoid the extra stuff you have in
there -- see if this works for you. It's in VB, not VB.Net, as mentioned
before, just dump this into Form_Load() or whatever.

Dim s As New MAPI.session
s.logon
Dim m As MAPI.message
Set m = s.outbox.Messages.Add
m.subject = "testing"
Dim r As MAPI.recipient
Set r = m.recipients.Add
r.Name = "Test Person"
r.address = "smtp:***@address.com" ' change this, of course
r.resolve
m.send

-- dan

Continue reading on narkive:
Loading...