Solved

VB.Net 2005 SMTP problem

Posted on 2006-11-29
4
757 Views
Last Modified: 2012-06-27
I can send mail just fine, except for one small problem that I haven't seen any solutions to.

Here's my code:

Dim mailMessage As New MailMessage(New MailAddress("TrustCallCenter@pioneertrustbank.com"), New MailAddress(ToEMail & "@pioneertrustbank.com"))
        With mailMessage
            .BodyEncoding = System.Text.Encoding.Default
            .Subject = "Call Center Callback Request"

            .Body = EMailBody.ToString
            .Priority = MailPriority.High
            .IsBodyHtml = False

            'Dim smptpermission As New SmtpPermission(Security.Permissions.PermissionState.Unrestricted)
            'smptpermission.Assert()

            Dim smtpMail As New SmtpClient
            smtpMail.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.Network

            smtpMail.Host = "mail.ptbna.com"
            smtpMail.Send(mailMessage)

            mailMessage = Nothing
            smtpMail = Nothing

The problem:  The mail does not actually get sent until after the program closes.  

How do I get the mail message to be sent immedately instead of waiting until the program closes?????

Thanks
Chuck
0
Comment
Question by:PTBNA
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 16

Expert Comment

by:Hillwaaa
ID: 18041598
Hi PTBNA,

What happens if you try the SendAsync method (instead of Send)?

Cheers,
Hillwaaa
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 500 total points
ID: 18042167
can it be your antivirus application?
0
 

Author Comment

by:PTBNA
ID: 18042359
Tried that not really understanding the difference, but there wasn't any difference.

The only thing left to try is building it and running from a cmd prompt.
0
 

Author Comment

by:PTBNA
ID: 18042402
Sometimes I hate Anit-Virus.  Because we were using SMTP for mail, Symantec blocks it until the program closes, and then checks the mail and releases it.

Thanks for the hint.

Chuck
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question