need help!

Public Sub emailNotification(ByVal strTo As String, ByVal strFrom As String)

    Try
        If strTo Is Nothing Then
            MessageBox.Show("Please Check Email")
        Else
            Dim [to] As New MailAddress(strTo)
            Dim [from] As New MailAddress(strFrom)
            Dim message As New MailMessage([from], [to])

            message.Subject = "Parcel Info No: (" + txtTracking.Text + ")"
            message.Body = "You have received new Parcel. please collect at KK3 office. " + Environment.NewLine + Environment.NewLine + "KK3 System"

            Dim client As New SmtpClient("smtp.googlemail.com")
            client.Send(message)

        End If
    Catch ex As Exception
        Dim str As String = [String].Format("Exception caught in CreateTestMessage5(): {0} - {1}", ex.ToString(), ex.Message)

        MessageBox.Show(str)

    End Try

End Sub

A string is rarely Nothing. But it can be empty.
Change the line If strTo Is Nothing Then to If String.IsNullOrEmpty(strTo) Then.
That should cover all the bases.

As a second thought, you should do the same for strFrom.
Include that in the If statement.

If String.IsNullOrEmpty(strTo) OrElse String.IsNullOrEmpty(strFrom) Then

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.