Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2008

Tip: Looking for answers? Try searching our database.

System.Net.Mail

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GastonFouche - 22 Jun 2006 16:45 GMT
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?
sloan - 22 Jun 2006 16:47 GMT
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)

> We are converting some applications from Frwk 1.1 to 2.0
>
[quoted text clipped - 6 lines]
>
> Any ideas why? and a workaround?
GastonFouche - 22 Jun 2006 17:03 GMT
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
sloan - 22 Jun 2006 18:07 GMT
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#.

> Here is the code...
>
[quoted text clipped - 15 lines]
>       MsgBox(ex.ToString)
>     End Try
Michael D. Ober - 23 Jun 2006 14:15 GMT

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.

> I'd try removing (for testing purposes) .. the attached file.
>
[quoted text clipped - 45 lines]
> >       MsgBox(ex.ToString)
> >     End Try
Kevin Spencer - 22 Jun 2006 17:01 GMT
> 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.

Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

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

> We are converting some applications from Frwk 1.1 to 2.0
>
[quoted text clipped - 6 lines]
>
> Any ideas why? and a workaround?
GastonFouche - 22 Jun 2006 17:07 GMT
See response to Slone,

code is there for viewing.. thanks

> > one curious Issue has arisen in out testing... The Email is not actually
> > sent out until the test app is closed..
[quoted text clipped - 13 lines]
> >
> > Any ideas why? and a workaround?
GastonFouche - 22 Jun 2006 18:33 GMT
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?

> We are converting some applications from Frwk 1.1 to 2.0
>
[quoted text clipped - 6 lines]
>
> Any ideas why? and a workaround?
Kevin Spencer - 22 Jun 2006 20:14 GMT
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!

Signature

HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

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

>I found your Problem... It's Norton AntiVirus...
>
[quoted text clipped - 22 lines]
>>
>> Any ideas why? and a workaround?
Michael D. Ober - 23 Jun 2006 14:16 GMT

Dump Norton?

Mike.

> I found your Problem... It's Norton AntiVirus...
>
[quoted text clipped - 20 lines]
> >
> > Any ideas why? and a workaround?
Mark Morrow - 11 Mar 2008 19:23 GMT
Dispose the objects and set them to nothing.  IE -

           smtpServer.Send(msg)
           msg.Dispose()
           smtpServer = Nothing
           msg = Nothing

We had the same issue, but this resolved it.

Thanks

From http://www.developmentnow.com/g/6_2006_6_0_0_776412/System-Net-Mail.ht

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.