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 ??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" <jasonjbwalton@.hotmail.com> wrote in message
news:aee8b23b.0401150255.65def350@.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 ??
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 '"aquien@.dominio.com"
.From = sFrom '"paraquien@.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" <jasonjbwalton@.hotmail.com> wrote in message
news:aee8b23b.0401150255.65def350@.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 ??
Try commenting the smtpMail.SmtpServer code, that worked for me !!!
Kind regards,
Jurjen de Groot
Netherlands.
"JJBW" <jasonjbwalton@.hotmail.com> wrote in message
news:aee8b23b.0401150255.65def350@.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 ??
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment