Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

No difference with ASP.NET asynchronous email

Posted on 2013-05-23
2
Medium Priority
?
350 Views
Last Modified: 2013-06-15
Hi, I was making some upgrades to my code for emails to be sent asynchronously however I notice there is no difference in the delay after the user click s the send button.

This is the normal code

  Dim mail As New MailMessage()
        mail.From = New MailAddress(Label9.Text)
        mail.To.Add(Label9.Text)

        'set the content
        mail.Subject = "Normal"

        mail.IsBodyHtml = True

        'send the message
        Dim smtp As New SmtpClient("smtpserver") '
        smtp.Send(mail)

Open in new window


This is the new asynchronous method;

 Dim mailMessage As New System.Net.Mail.MailMessage

        mailMessage.From = New MailAddress(Label9.Text)
        mailMessage.To.Add("itsupport@seabrookcrisps.com")

        mailMessage.Subject = "Async Email"

        mailMessage.IsBodyHtml = True
        mailMessage.Body = "Test"

        Dim smtpClient As New SmtpClient()
        Dim userState As Object = mailMessage

        'Attach event handler for async callback
        AddHandler smtpClient.SendCompleted, AddressOf SmtpClient_OnCompleted

        Try
            'Send the email asynchronously
            smtpClient.SendAsync(mailMessage, userState)
        Catch smtpEx As SmtpException
            'Error handling here
        Catch ex As Exception
            'Error handling here
        End Try

Open in new window


Any ideas?
0
Comment
Question by:takwirirar
2 Comments
 
LVL 29

Accepted Solution

by:
Kumaraswamy R earned 2000 total points
ID: 39190487
send a test email asynchronously, following the steps in the debug mode, and view the actual email received from the process

http://www.asp.net/web-forms/videos/how-do-i/how-do-i-send-email-asynchronously-with-aspnet
0
 
LVL 1

Author Comment

by:takwirirar
ID: 39202013
Ok will do
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

783 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