Solved

No difference with ASP.NET asynchronous email

Posted on 2013-05-23
2
340 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
[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 Comments
 
LVL 29

Accepted Solution

by:
Kumaraswamy R earned 500 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

735 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