By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,810 Members | 783 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,810 IT Pros & Developers. It's quick & easy.

SmtpMail problem

P: n/a
Hi

I am having a bit of a problem with SmtpMail. I have a bit of code
that should send an email but when it is executed no email turns up.

MailMessage mmNotify = new MailMessage();

mmNotify.From = [from email address];
mmNotify.To = [recipient email address];
mmNotify.BodyFormat = MailFormat.Text;
mmNotify.Subject = [my subject];
mmNotify.Body = [my body text];

SmtpMail.SmtpServer = "localhost";

SmtpMail.Send(mmNotify);

If I stop my SmtpServer (which runs on my box) I get the following
error message:

Cannot access CDO.Message object

If I then start the SmtpServer the message does not arise.

I assume that this means the MailMessage object get created.

When the send method is called an exception is not created and the
code continues to execute.

What happens to my email ? Where does it go ? It doesn't even end up
in the DROP, BADMAIL etc folders
Any suggestions ????
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Sounds to me to be a problem with your mail server than with your code
(Which looks fine to me). Have you tried setting the mail server to
something different than your local box and see what happens?

"JJBW" <ja***********@hotmail.com> wrote in message
news:ae**************************@posting.google.c om...
Hi

I am having a bit of a problem with SmtpMail. I have a bit of code
that should send an email but when it is executed no email turns up.

MailMessage mmNotify = new MailMessage();

mmNotify.From = [from email address];
mmNotify.To = [recipient email address];
mmNotify.BodyFormat = MailFormat.Text;
mmNotify.Subject = [my subject];
mmNotify.Body = [my body text];

SmtpMail.SmtpServer = "localhost";

SmtpMail.Send(mmNotify);

If I stop my SmtpServer (which runs on my box) I get the following
error message:

Cannot access CDO.Message object

If I then start the SmtpServer the message does not arise.

I assume that this means the MailMessage object get created.

When the send method is called an exception is not created and the
code continues to execute.

What happens to my email ? Where does it go ? It doesn't even end up
in the DROP, BADMAIL etc folders
Any suggestions ????

Nov 18 '05 #2

P: n/a

Hi, JJBW !
It could be a relay o authentication issue !
Try this using CDO..
*****
Dim iMsg As New CDO.Message()
Dim iConf As New CDO.Configuration()

Dim Flds As ADODB.Fields

Flds = iConf.Fields

With Flds
'.Item(cdoSMTPConnectionTimeout).Value = 20 '
quick timeout
'.Item(cdoURLProxyServer).Value = "<local>"
'.Item(cdoURLGetLatestVersion).Value = True

.Item
("http://schemas.microsoft.com/cdo/configuration/sendusing"
).Value = 2
.Item
("http://schemas.microsoft.com/cdo/configuration/smtpserver
").Value = SMTPServer
.Item
("http://schemas.microsoft.com/cdo/configuration/smtpserver
port").Value = 25

.Item
("http://schemas.microsoft.com/cdo/configuration/smtpauthen
ticate").Value = 1
.Item
("http://schemas.microsoft.com/cdo/configuration/senduserna
me").Value = "usuario"
.Item
("http://schemas.microsoft.com/cdo/configuration/sendpasswo
rd").Value = "password"
.Update()
End With

With iMsg
.Configuration = iConf
.To = ToList '"aq****@dominio.com"
.From = sFrom '"paraq****@dominio.com"
.Subject = Subject '"A Subject Line"
.TextBody = sBody '"A Text body message"

.Fields.Update()
.Send()
End With

I Hope this help..

ONil@.
MX.
"JJBW" <ja***********@hotmail.com> wrote in message
news:ae**************************@posting.google.c om...
Hi

I am having a bit of a problem with SmtpMail. I have a bit of code
that should send an email but when it is executed no email turns up.

MailMessage mmNotify = new MailMessage();

mmNotify.From = [from email address];
mmNotify.To = [recipient email address];
mmNotify.BodyFormat = MailFormat.Text;
mmNotify.Subject = [my subject];
mmNotify.Body = [my body text];

SmtpMail.SmtpServer = "localhost";

SmtpMail.Send(mmNotify);

If I stop my SmtpServer (which runs on my box) I get the following
error message:

Cannot access CDO.Message object

If I then start the SmtpServer the message does not arise.

I assume that this means the MailMessage object get created.

When the send method is called an exception is not created and the
code continues to execute.

What happens to my email ? Where does it go ? It doesn't even end up
in the DROP, BADMAIL etc folders
Any suggestions ????

Nov 18 '05 #3

P: n/a
Try commenting the smtpMail.SmtpServer code, that worked for me !!!

Kind regards,
Jurjen de Groot
Netherlands.

"JJBW" <ja***********@hotmail.com> wrote in message
news:ae**************************@posting.google.c om...
Hi

I am having a bit of a problem with SmtpMail. I have a bit of code
that should send an email but when it is executed no email turns up.

MailMessage mmNotify = new MailMessage();

mmNotify.From = [from email address];
mmNotify.To = [recipient email address];
mmNotify.BodyFormat = MailFormat.Text;
mmNotify.Subject = [my subject];
mmNotify.Body = [my body text];

SmtpMail.SmtpServer = "localhost";

SmtpMail.Send(mmNotify);

If I stop my SmtpServer (which runs on my box) I get the following
error message:

Cannot access CDO.Message object

If I then start the SmtpServer the message does not arise.

I assume that this means the MailMessage object get created.

When the send method is called an exception is not created and the
code continues to execute.

What happens to my email ? Where does it go ? It doesn't even end up
in the DROP, BADMAIL etc folders
Any suggestions ????

Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.