Home Search Member List Faq Register Login  
UltimateEmail
Emails take a long time

Thread Starter: Jackzzz   Started: 11-09-2012 5:57 PM   Replies: 0
 Karamasoft Support Forums » General Discussions » UltimateEmail » Emails take a long time
 Printable Version    « Previous Thread   Next Thread »
  09 Nov 2012, 5:57 PM
Jackzzz is not online. Last active: 2/13/2014 6:08:24 PM Jackzzz

Top 10 Posts
Joined on 05-15-2012
Posts 27
Emails take a long time

I have this code in a vb class named systemalerts. The code works fine, but the emails take about 8 to 10 seconds to go out. The sproc executes in less than a second if I hard code an ID in it, so I was thinking there might be a setting for the UltimateEmail that could help with the speed or maybe you might have a suggestion for the code to speed it up.

Thank you,

Imports Microsoft.VisualBasic
Imports System.Data
Imports System.Data.SqlClient
Imports Karamasoft.WebControls.UltimateEmail

Public Class SystemAlerts

    Public Shared Sub SendAlert(ByVal intDon_ID As Int32)
        Dim mailMerge As New MailMerge
        mailMerge.IsBodyHtml = True
        Dim Row As DataRow
        Dim DS As New DataSet
        Dim dt As DataTable
        Dim ConnectStr As String = _
        ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString
        Dim AlertCommand As New SqlCommand
        Dim MyAdapter As New SqlDataAdapter(AlertCommand)

        Try

            'Get Alert Email Columns
            AlertCommand.CommandType = CommandType.StoredProcedure
            AlertCommand.Connection = New SqlConnection(ConnectStr)
            AlertCommand.CommandText = "Alert"

            AlertCommand.Parameters.AddWithValue("@Don_ID", intDon_ID)

            MyAdapter.Fill(DS)
            dt = DS.Tables(0)

            If dt.Rows.Count <> Nothing Then
                Row = DS.Tables(0).Rows(0)
                mailMerge.FromDisplayNameTemplate = Row.Item("FromName").ToString()
                mailMerge.FromAddressTemplate = Row.Item("FromAddress").ToString()
                mailMerge.ToAddressTemplate = Row.Item("AlertTo").ToString()
                mailMerge.SubjectTemplate = Row.Item("AlertSubject").ToString()
                mailMerge.BodyTemplate = HttpContext.Current.Server.HtmlDecode(Row.Item("AlertMessage").ToString())
                mailMerge.DataSource = DS

                'Don't Send if False
                If Row.Item("ActivateAlert") = True Then
                    mailMerge.SendMailMerge()
                End If
            End If
        Catch EX As Exception
            HttpContext.Current.Response.Write(EX.Message)
        Finally
            MyAdapter.Dispose()
            AlertCommand.Dispose()
            AlertCommand.Connection.Close()
            DS.Dispose()
        End Try
    End Sub
End Class

I call it like this in my code behind

SystemAlerts.SendAlert(iDonID)


 


  
 Page 1 of 1 (1 items)
Karamasoft Support Forums » General Discussions » UltimateEmail » Emails take a long time

You can add attachments
You can post new topics
You can reply to topics
You can delete your posts
You can edit your posts
You can create polls
You can vote in polls
Forum statistics are enabled
Forum is unmoderated

© 2002-2018 Karamasoft LLC. All rights reserved.