SmtpMail problem

J

JJBW

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 ????
 
M

Michael

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?
 
O

ONIL@

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 '"(e-mail address removed)"
.From = sFrom '"(e-mail address removed)"
.Subject = Subject '"A Subject Line"
.TextBody = sBody '"A Text body message"

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

I Hope this help..

ONil@.
MX.
 
J

Jurjen de Groot

Try commenting the smtpMail.SmtpServer code, that worked for me !!!

Kind regards,
Jurjen de Groot
Netherlands.
 

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

Similar Threads

SMTPMAIL 3
SMTPMail Error 3
SmtpMail 4
SmtpMail problem 2
SmtpMail 1
mail problem 2
SmtpMail error 0
SmtpMail Problem 2

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top