|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to determine if e-mail was sent OKWith 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 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 > > Thanks for code but I don't understand what Username and Password the code
refers to? Can you help me to understand. -- Show quoteHide quoteDennis 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 > > > > > > > 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 >> > >> > >> >> >> 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 >> >> > > 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 >>> >>> >> >>
Other interesting topics
Why not use DAO?
How I can find out on which platform I am running (32/64 bits)? Make inherited property invisible mouse right click your favorite VB 2005 book? Form Focus Windows Service to copy files to a Mapped Drive Add Active Directory Users to a Group on a Workstation schema.ini Pipe Delimited to Access Database change date |
|||||||||||||||||||||||