Home All Groups Group Topic Archive Search About

How to determine if e-mail was sent OK

Author
22 Dec 2006 7:00 PM
Robert Dufour
With system.web.mail in VS2003, doing some tests, using localhost from IIS
as server, I noticed that my code queues the messages OK, but when changing
sender addresses I see that the mail message ends up in the Bad folder. I
need to know when that happens since the e-mails are of critical importance.
How can I detect in my code, if an e-mail got queued but the actual
transmission from the server was unsuccessfull and how can I find what the
reason for the failure was?

Any help would be appreciated,

Bob

Author
22 Dec 2006 7:45 PM
vbnetdev
authenticate and avoid the problem entirely....1.1 and above

Private Sub Page_Load(sender As Object, e As System.EventArgs)
   Dim mail As New MailMessage()
   mail.To = "m*@mycompany.com"
   mail.From = "y**@yourcompany.com"
   mail.Subject = "this is a test email."
   mail.Body = "Some text goes here"
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
"1") 'basic authentication
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
"my_username_here") 'set your username here
   mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
"super_secret") 'set your password here
   SmtpMail.SmtpServer = "mail.mycompany.com" 'your real server goes here
   SmtpMail.Send(mail)
End Sub 'Page_Load

Show quoteHide quote
"Robert Dufour" <bduf***@sgiims.com> wrote in message
news:eUowzufJHHA.4068@TK2MSFTNGP03.phx.gbl...
> With system.web.mail in VS2003, doing some tests, using localhost from IIS
> as server, I noticed that my code queues the messages OK, but when
> changing sender addresses I see that the mail message ends up in the Bad
> folder. I need to know when that happens since the e-mails are of critical
> importance. How can I detect in my code, if an e-mail got queued but the
> actual transmission from the server was unsuccessfull and how can I find
> what the reason for the failure was?
>
> Any help would be appreciated,
>
> Bob
>
>
Are all your drivers up to date? click for free checkup

Author
23 Dec 2006 9:10 PM
Dennis
Thanks for code but I don't understand what Username and  Password the code
refers to?  Can you help me to understand.
--
Dennis in Houston


Show quoteHide quote
"vbnetdev" wrote:

> authenticate and avoid the problem entirely....1.1 and above
>
> Private Sub Page_Load(sender As Object, e As System.EventArgs)
>    Dim mail As New MailMessage()
>    mail.To = "m*@mycompany.com"
>    mail.From = "y**@yourcompany.com"
>    mail.Subject = "this is a test email."
>    mail.Body = "Some text goes here"
>    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
> "1") 'basic authentication
>    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
> "my_username_here") 'set your username here
>    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
> "super_secret") 'set your password here
>    SmtpMail.SmtpServer = "mail.mycompany.com" 'your real server goes here
>    SmtpMail.Send(mail)
> End Sub 'Page_Load
>
> "Robert Dufour" <bduf***@sgiims.com> wrote in message
> news:eUowzufJHHA.4068@TK2MSFTNGP03.phx.gbl...
> > With system.web.mail in VS2003, doing some tests, using localhost from IIS
> > as server, I noticed that my code queues the messages OK, but when
> > changing sender addresses I see that the mail message ends up in the Bad
> > folder. I need to know when that happens since the e-mails are of critical
> > importance. How can I detect in my code, if an e-mail got queued but the
> > actual transmission from the server was unsuccessfull and how can I find
> > what the reason for the failure was?
> >
> > Any help would be appreciated,
> >
> > Bob
> >
> >
>
>
>
Author
24 Dec 2006 2:36 PM
vbnetdev
The username and password used to access the email account for that mail
server.

Show quoteHide quote
"Dennis" <Den***@discussions.microsoft.com> wrote in message
news:F330418D-7B20-4A87-918C-C506C45648AE@microsoft.com...
> Thanks for code but I don't understand what Username and  Password the
> code
> refers to?  Can you help me to understand.
> --
> Dennis in Houston
>
>
> "vbnetdev" wrote:
>
>> authenticate and avoid the problem entirely....1.1 and above
>>
>> Private Sub Page_Load(sender As Object, e As System.EventArgs)
>>    Dim mail As New MailMessage()
>>    mail.To = "m*@mycompany.com"
>>    mail.From = "y**@yourcompany.com"
>>    mail.Subject = "this is a test email."
>>    mail.Body = "Some text goes here"
>>
>> mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
>> "1") 'basic authentication
>>
>> mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
>> "my_username_here") 'set your username here
>>
>> mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
>> "super_secret") 'set your password here
>>    SmtpMail.SmtpServer = "mail.mycompany.com" 'your real server goes here
>>    SmtpMail.Send(mail)
>> End Sub 'Page_Load
>>
>> "Robert Dufour" <bduf***@sgiims.com> wrote in message
>> news:eUowzufJHHA.4068@TK2MSFTNGP03.phx.gbl...
>> > With system.web.mail in VS2003, doing some tests, using localhost from
>> > IIS
>> > as server, I noticed that my code queues the messages OK, but when
>> > changing sender addresses I see that the mail message ends up in the
>> > Bad
>> > folder. I need to know when that happens since the e-mails are of
>> > critical
>> > importance. How can I detect in my code, if an e-mail got queued but
>> > the
>> > actual transmission from the server was unsuccessfull and how can I
>> > find
>> > what the reason for the failure was?
>> >
>> > Any help would be appreciated,
>> >
>> > Bob
>> >
>> >
>>
>>
>>
Author
27 Dec 2006 7:03 PM
cj
I'm interested in your code but don't understand the
"http://schemas...." you have in it.  This is what I've been using.  Can
you explain the difference?  Mine works.  Just curious.

             Dim msg As New System.Net.Mail.MailMessage
             Dim smtp As New System.Net.Mail.SmtpClient
             msg.From = New System.Net.Mail.MailAddress("cj@my_co.com")
             msg.To.Add("Sally@my_co.com,Bob@his_co.com")
             msg.Subject = "This is a test"
             msg.Body = "This is only a test" & vbcrlf & "1 2 3"
             smtp.Host = "smtp.my_co.com"
             smtp.Port = 25
             smtp.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
             smtp.Credentials = New
System.Net.NetworkCredential("me@my_co.com", "my_pass")
             smtp.Send(msg)


vbnetdev wrote:
Show quoteHide quote
> authenticate and avoid the problem entirely....1.1 and above
>
> Private Sub Page_Load(sender As Object, e As System.EventArgs)
>    Dim mail As New MailMessage()
>    mail.To = "m*@mycompany.com"
>    mail.From = "y**@yourcompany.com"
>    mail.Subject = "this is a test email."
>    mail.Body = "Some text goes here"
>    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
> "1") 'basic authentication
>    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
> "my_username_here") 'set your username here
>    mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
> "super_secret") 'set your password here
>    SmtpMail.SmtpServer = "mail.mycompany.com" 'your real server goes here
>    SmtpMail.Send(mail)
> End Sub 'Page_Load
>
> "Robert Dufour" <bduf***@sgiims.com> wrote in message
> news:eUowzufJHHA.4068@TK2MSFTNGP03.phx.gbl...
>> With system.web.mail in VS2003, doing some tests, using localhost from IIS
>> as server, I noticed that my code queues the messages OK, but when
>> changing sender addresses I see that the mail message ends up in the Bad
>> folder. I need to know when that happens since the e-mails are of critical
>> importance. How can I detect in my code, if an e-mail got queued but the
>> actual transmission from the server was unsuccessfull and how can I find
>> what the reason for the failure was?
>>
>> Any help would be appreciated,
>>
>> Bob
>>
>>
>
>
Author
27 Dec 2006 7:06 PM
cj
actually "me@my_co.com" should be "cj@my_co.com" just example names
anyway but the same address is used from msg.from and in the network
credential.

cj wrote:
Show quoteHide quote
> I'm interested in your code but don't understand the
> "http://schemas...." you have in it.  This is what I've been using.  Can
> you explain the difference?  Mine works.  Just curious.
>
>             Dim msg As New System.Net.Mail.MailMessage
>             Dim smtp As New System.Net.Mail.SmtpClient
>             msg.From = New System.Net.Mail.MailAddress("cj@my_co.com")
>             msg.To.Add("Sally@my_co.com,Bob@his_co.com")
>             msg.Subject = "This is a test"
>             msg.Body = "This is only a test" & vbcrlf & "1 2 3"
>             smtp.Host = "smtp.my_co.com"
>             smtp.Port = 25
>             smtp.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network
>             smtp.Credentials = New
> System.Net.NetworkCredential("me@my_co.com", "my_pass")
>             smtp.Send(msg)
>
>
> vbnetdev wrote:
>> authenticate and avoid the problem entirely....1.1 and above
>>
>> Private Sub Page_Load(sender As Object, e As System.EventArgs)
>>    Dim mail As New MailMessage()
>>    mail.To = "m*@mycompany.com"
>>    mail.From = "y**@yourcompany.com"
>>    mail.Subject = "this is a test email."
>>    mail.Body = "Some text goes here"
>>   
>> mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate",
>> "1") 'basic authentication
>>   
>> mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername",
>> "my_username_here") 'set your username here
>>   
>> mail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword",
>> "super_secret") 'set your password here
>>    SmtpMail.SmtpServer = "mail.mycompany.com" 'your real server goes here
>>    SmtpMail.Send(mail)
>> End Sub 'Page_Load
>>
>> "Robert Dufour" <bduf***@sgiims.com> wrote in message
>> news:eUowzufJHHA.4068@TK2MSFTNGP03.phx.gbl...
>>> With system.web.mail in VS2003, doing some tests, using localhost
>>> from IIS as server, I noticed that my code queues the messages OK,
>>> but when changing sender addresses I see that the mail message ends
>>> up in the Bad folder. I need to know when that happens since the
>>> e-mails are of critical importance. How can I detect in my code, if
>>> an e-mail got queued but the actual transmission from the server was
>>> unsuccessfull and how can I find what the reason for the failure was?
>>>
>>> Any help would be appreciated,
>>>
>>> Bob
>>>
>>>
>>
>>

Bookmark and Share