Home Search Member List Faq Register Login  
UltimateEmail
Re: Email Invalid

Thread Starter: Jackzzz   Started: 11-15-2012 1:38 PM   Replies: 3
 Karamasoft Support Forums » General Discussions » UltimateEmail » Re: Email Invalid
 Printable Version    « Previous Thread   Next Thread »
  15 Nov 2012, 1:38 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
Email Invalid

We use the following code and it keeps showing good emails as invalid. Are we doing this correctly?

    Private Sub OnBeforeSend1(ByVal sender As Object, ByVal e As BeforeSendEventArgs)
        Dim mailMsg As MailMessage = e.MergedMail
        Dim mergeStatus As Boolean = e.MergeStatus
        Dim val As New Validator
        Dim dr As Data.DataRow = e.DataRow

        Dim cmdInsert As SqlCommand
        Dim myNewID As Integer
        Dim ConnectStr As String = _
        ConfigurationManager.ConnectionStrings("ConnectionString").ConnectionString

        cmdInsert = New SqlCommand
        cmdInsert.CommandText = "AddEmail"
        cmdInsert.CommandType = CommandType.StoredProcedure
        cmdInsert.Connection = New SqlConnection(ConnectStr)

        ' Validate email address using the Validator component before sending

        If (val.ValidateEmailAddress(e.MergedMail.To(0).Address) <> ValidationLevel.Account) Then
            ' Cancel this particular email by setting SendMergedMail to false
            e.SendMergedMail = False

            cmdInsert.Parameters.AddWithValue("@r_ID", e.DataRow.Item(0))
            cmdInsert.Parameters.AddWithValue("@ge_ID", e.DataRow.Item(1))
            cmdInsert.Parameters.AddWithValue("@EmailDateSent", System.DateTime.Today.ToShortDateString())
            cmdInsert.Parameters.AddWithValue("@EmailTo", e.MergedMail.To.ToString)
            cmdInsert.Parameters.AddWithValue("@EmailType", "IT")
            cmdInsert.Parameters.AddWithValue("@EmailStatus", "Invalid")
            cmdInsert.Parameters.AddWithValue("@EmailSubject", e.MergedMail.Subject.ToString)
            cmdInsert.Parameters.AddWithValue("@DateEntered", System.DateTime.UtcNow)
            cmdInsert.Parameters.AddWithValue("@EnteredBy", UserName)
            cmdInsert.Parameters.AddWithValue("@LastUpdate", System.DateTime.UtcNow)
            cmdInsert.Parameters.AddWithValue("@LastUpdateBy", UserName)
            cmdInsert.Parameters.AddWithValue("@EmailFrom", e.MergedMail.From.ToString)
            If String.IsNullOrEmpty(e.DataRow.Item(21)) Then
                cmdInsert.Parameters.AddWithValue("@EmailSel", DBNull.Value)
            Else
                cmdInsert.Parameters.AddWithValue("@EmailSel", e.DataRow.Item(21))
            End If

            Try
                cmdInsert.Connection.Open()
                myNewID = cmdInsert.ExecuteScalar()
            Catch ex As Exception
                Response.Write(ex.Message)
            Finally
                cmdInsert.Connection.Close()
            End Try

        End If


  
  15 Nov 2012, 2:43 PM
Karamasoft is not online. Last active: 11/10/2017 3:24:14 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,818
Re: Email Invalid
When you validate email addresses, domain level checks usually respond successfully. However, SMTP and Account level checks may be too retricted, and you will be at the mercy of the SMTP server. Some servers may validate properly, while others return failures automatically without even validating the address. Therefore, they may not be very reliable.
  
  25 Nov 2012, 12:54 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
Re: Email Invalid
So should we just not use your validation for SMTP servers?
  
  25 Nov 2012, 1:26 PM
Karamasoft is not online. Last active: 11/10/2017 3:24:14 PM Karamasoft

Top 10 Posts
Joined on 09-05-2004
Posts 6,818
Re: Email Invalid
It's your decision based on your experience with SMTP servers.
  
 Page 1 of 1 (4 items)
Karamasoft Support Forums » General Discussions » UltimateEmail » Re: Email Invalid

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.