System.Net.Mail

G

Guest

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

sloan

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)
 
K

Kevin Spencer

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.
 
G

Guest

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
 
S

sloan

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#.
 
G

Guest

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

Kevin Spencer

AntiVirus software is famous for interfering with software development in
general. Norton is reputably the best, but it sucks for us developers. I
don't use live protection of any kind. I just do scheduled scans during down
time. And I try to stay away from anything that might give me a virus!

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

I recycle.
I send everything back to the planet it came from.
 
M

Michael D. Ober

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

Michael D. Ober

Dump Norton?

Mike.

GastonFouche said:
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?
 

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

Top