|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
System.Net.MailWe are converting some applications from Frwk 1.1 to 2.0
We have changed System.web.mail to System.net.mail.. (using the samples provider by msdn site to send mail (quite easy, its almost the same) one curious Issue has arisen in out testing... The Email is not actually sent out until the test app is closed.. Any ideas why? and a workaround? Your question is a little vague.
I have some 1.1 and 2.0 overlapping examples at: http://sholliday.spaces.msn.com/ 2/8/2006 entry You need to check your wwwroot/mail folder also. Are they being help up in one of those subfolders? Because your smtp server might have several different authentication mechanisms...... there's not really blanket answers for smtp. (in my experience) Show quote "GastonFouche" <GastonFou***@discussions.microsoft.com> wrote in message news:6F8BE76D-95AE-429E-A88C-D36D87F4CA7C@microsoft.com... > We are converting some applications from Frwk 1.1 to 2.0 > > We have changed System.web.mail to System.net.mail.. > (using the samples provider by msdn site to send mail (quite easy, its > almost the same) > > one curious Issue has arisen in out testing... The Email is not actually > sent out until the test app is closed.. > > Any ideas why? and a workaround? > > > Here is the code...
This code executes just fine.. the email however is not actually sent until the application is closed... Try Dim objMail As New System.Net.Mail.MailMessage(EMAIL_FROM, UserName & "@" & ALLOWED_DOMAIN & ".com") objMail.Attachments.Add(New System.Net.Mail.Attachment(DecryptedFileName)) objMail.Bcc.Add(EMAIL_FROM) objMail.Subject = "Decrypted File: " & ShortName objMail.IsBodyHtml = True objMail.Priority = Net.Mail.MailPriority.Normal Dim objSMTP As New System.Net.Mail.SmtpClient(EMAIL_SERVER) objSMTP.Send(objMail) Catch ex As Exception MsgBox(ex.ToString) End Try I'd try removing (for testing purposes) .. the attached file.
maybe your app has a lock on the file or something? you also .. (as a general rule in vb.net) place Option Strict On Option Explicit On at the top of every class...........as in.. ~every class.............. Why? This line is deficient: > Dim objMail As New System.Net.Mail.MailMessage(EMAIL_FROM, UserName With stronger typing, it should be:& > "@" & ALLOWED_DOMAIN & ".com") > Dim objMail As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage(EMAIL_FROM, UserName &> "@" & ALLOWED_DOMAIN & ".com") I can't prove it does/affects anything, but perhaps it can.The "Option" stuff makes the syntax more strongly typed, like c#. Show quote "GastonFouche" <GastonFou***@discussions.microsoft.com> wrote in message news:7460951D-072F-49B8-B29B-F294CF6EB398@microsoft.com... > Here is the code... > > This code executes just fine.. the email however is not actually sent until > the application is closed... > > Try > Dim objMail As New System.Net.Mail.MailMessage(EMAIL_FROM, UserName & > "@" & ALLOWED_DOMAIN & ".com") > objMail.Attachments.Add(New > System.Net.Mail.Attachment(DecryptedFileName)) > objMail.Bcc.Add(EMAIL_FROM) > objMail.Subject = "Decrypted File: " & ShortName > objMail.IsBodyHtml = True > objMail.Priority = Net.Mail.MailPriority.Normal > Dim objSMTP As New System.Net.Mail.SmtpClient(EMAIL_SERVER) > objSMTP.Send(objMail) > Catch ex As Exception > MsgBox(ex.ToString) > End Try I just put OPs code into a blank VB 2005 project with Explicit and Strict
On. Code will compile as is. dim objMail as New System.Net.Mail.Message(...) is syntactically the same as dim objMail as System.Net.MailMessage = new System.Net.Mail.Message(...) ================ What happens when your code is run in the debugger and you single step through it? Does the email go immediately or later? Mike Ober. What happens when you single step through your code. Show quote "sloan" <sl***@ipass.net> wrote in message news:uGBsk7hlGHA.4244@TK2MSFTNGP02.phx.gbl... > > > I'd try removing (for testing purposes) .. the attached file. > > maybe your app has a lock on the file or something? > > you also .. (as a general rule in vb.net) place > > Option Strict On > Option Explicit On > > at the top of every class...........as in.. ~every class.............. > > Why? > > This line is deficient: > > Dim objMail As New System.Net.Mail.MailMessage(EMAIL_FROM, UserName > & > > "@" & ALLOWED_DOMAIN & ".com") > > With stronger typing, it should be: > > > Dim objMail As System.Net.Mail.MailMessage = New > System.Net.Mail.MailMessage(EMAIL_FROM, UserName & > > "@" & ALLOWED_DOMAIN & ".com") > > I can't prove it does/affects anything, but perhaps it can. > > The "Option" stuff makes the syntax more strongly typed, like c#. > > > > > > "GastonFouche" <GastonFou***@discussions.microsoft.com> wrote in message > news:7460951D-072F-49B8-B29B-F294CF6EB398@microsoft.com... > > Here is the code... > > > > This code executes just fine.. the email however is not actually sent > until > > the application is closed... > > > > Try > > Dim objMail As New System.Net.Mail.MailMessage(EMAIL_FROM, UserName > & > > "@" & ALLOWED_DOMAIN & ".com") > > objMail.Attachments.Add(New > > System.Net.Mail.Attachment(DecryptedFileName)) > > objMail.Bcc.Add(EMAIL_FROM) > > objMail.Subject = "Decrypted File: " & ShortName > > objMail.IsBodyHtml = True > > objMail.Priority = Net.Mail.MailPriority.Normal > > Dim objSMTP As New System.Net.Mail.SmtpClient(EMAIL_SERVER) > > objSMTP.Send(objMail) > > Catch ex As Exception > > MsgBox(ex.ToString) > > End Try > > > > one curious Issue has arisen in out testing... The Email is not actually Ask the person who wrote the app. The app is a set of instructions, which > sent out until the test app is closed.. includes instructions regarding how the SmtpClient is to be used. As we have no access to the code, we can only make wild guesses. -- Show quoteHTH, Kevin Spencer Microsoft MVP Professional Chicken Salad Alchemist I recycle. I send everything back to the planet it came from. "GastonFouche" <GastonFou***@discussions.microsoft.com> wrote in message news:6F8BE76D-95AE-429E-A88C-D36D87F4CA7C@microsoft.com... > We are converting some applications from Frwk 1.1 to 2.0 > > We have changed System.web.mail to System.net.mail.. > (using the samples provider by msdn site to send mail (quite easy, its > almost the same) > > one curious Issue has arisen in out testing... The Email is not actually > sent out until the test app is closed.. > > Any ideas why? and a workaround? > > > See response to Slone,
code is there for viewing.. thanks Show quote "Kevin Spencer" wrote: > > one curious Issue has arisen in out testing... The Email is not actually > > sent out until the test app is closed.. > > Ask the person who wrote the app. The app is a set of instructions, which > includes instructions regarding how the SmtpClient is to be used. As we have > no access to the code, we can only make wild guesses. > > -- > HTH, > > Kevin Spencer > Microsoft MVP > Professional Chicken Salad Alchemist > > I recycle. > I send everything back to the planet it came from. > > "GastonFouche" <GastonFou***@discussions.microsoft.com> wrote in message > news:6F8BE76D-95AE-429E-A88C-D36D87F4CA7C@microsoft.com... > > We are converting some applications from Frwk 1.1 to 2.0 > > > > We have changed System.web.mail to System.net.mail.. > > (using the samples provider by msdn site to send mail (quite easy, its > > almost the same) > > > > one curious Issue has arisen in out testing... The Email is not actually > > sent out until the test app is closed.. > > > > Any ideas why? and a workaround? > > > > > > > > > I found your Problem... It's Norton AntiVirus...
If you Disable "E-Mail Auto-Protection" the emails go out just fine as it should... If you Enable "E-Mail Auto-Protection" The emails will not go out until the test app is closed... Why this happens? I do not know... Does anyone else? Anyone got a work around that does not involve Turning off e-Mail Protection? Show quote "GastonFouche" wrote: > We are converting some applications from Frwk 1.1 to 2.0 > > We have changed System.web.mail to System.net.mail.. > (using the samples provider by msdn site to send mail (quite easy, its > almost the same) > > one curious Issue has arisen in out testing... The Email is not actually > sent out until the test app is closed.. > > Any ideas why? and a workaround? > > > Dump Norton?
Mike. Show quote "GastonFouche" <GastonFou***@discussions.microsoft.com> wrote in message news:65CFE515-3A1A-4F8D-B010-DD1434F7E37B@microsoft.com... > I found your Problem... It's Norton AntiVirus... > > If you Disable "E-Mail Auto-Protection" the emails go out just fine as it > should... > > If you Enable "E-Mail Auto-Protection" The emails will not go out until the > test app is closed... > > Why this happens? I do not know... > > Does anyone else? > > Anyone got a work around that does not involve Turning off e-Mail Protection? > > > "GastonFouche" wrote: > > > We are converting some applications from Frwk 1.1 to 2.0 > > > > We have changed System.web.mail to System.net.mail.. > > (using the samples provider by msdn site to send mail (quite easy, its > > almost the same) > > > > one curious Issue has arisen in out testing... The Email is not actually > > sent out until the test app is closed.. > > > > Any ideas why? and a workaround? > > > > > > > |
|||||||||||||||||||||||