• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Check the validity of email

Status
Not open for further replies.
Good evening.

I have a list of emails and I would like to understand which of them are valid and which are not.

There are programs that allow you to do this type of verification and I thought I'd ask if it is also possible to do it with VBA.

Thanks
 
I probably expressed myself badly. I was not referring to the synthase but to the existence of the email. I know that online systems and software send an stmp request (I am not if I wrote it correctly) and from this request it emerges if the email exists.
 
I would like to understand if it is also possible to do it with a macro but I have not found anything on google and in the forums. Maybe it's not possible
 
Code:
Const ConnectNormal = 0
Const ConnectSSLAuto = 1
Const ConnectSTARTTLS = 2
Const ConnectDirectSSL = 3
Const ConnectTryTLS = 4

Sub EmailAddrTest()

    Dim oSmtp As New EASendMailObjLib.Mail
    Dim ConnectTryTLS
    oSmtp.LicenseCode = "TryIt"

    ' Set your sender email address
    oSmtp.FromAddr = "youremail@yahoo.com"
    ' Add recipient email address
    oSmtp.AddRecipientEx "emailaddressbeingtested@gmail.com", 0

    ' Set email subject
    oSmtp.Subject = "simple email from VB 6.0 project"
    ' Set email body
    oSmtp.BodyText = "this is a test email sent from VB 6.0 project, do not reply"

    ' Your SMTP server address
    oSmtp.ServerAddr = "smtp.yahoo.com"

    ' User and password for ESMTP authentication, if your server doesn't require
    ' User authentication, please remove the following codes.
    oSmtp.UserName = "yours@yahoo.com"
    oSmtp.Password = "your password here"

    ' ConnectTryTLS means if server supports SSL/TLS connection, SSL/TLS is used automatically
    oSmtp.ConnectType = ConnectTryTLS

    ' If your server uses 587 port
    ' oSmtp.ServerPort = 587

    ' If your server uses 25/587/465 port with SSL/TLS
    ' oSmtp.ConnectType = ConnectSSLAuto
    ' oSmtp.ServerPort = 25 ' 25 or 587 or 465

    MsgBox "start to send email ..."
    If oSmtp.SendMail() = 0 Then
        MsgBox "email was sent successfully!"
    Else
        MsgBox "failed to send email with the following error:" & oSmtp.GetLastErrDescription()
    End If

End Sub

Be certain to download and install the reference file : EASendMailObjLib.Mail discussed in the link provided.
 
Last edited:
Hi Logit.

I entered the code and selected the reference to objects after installing it on the pc.

When I start the macro, a sending message comes out, but then it stops and the message you see attached appears.
72940
Basically you can also use the visual basic code. I thought not ...
 
You will need to make certain the correct email and password are used in the macro code.
It might take some "playing with" to get it correct. I had to check the internet for my
YAHOO email to be certain I was using the correct SERVER PORT number and SMTP
mail address.

It did work successfully here checking my personal email address.
 
Is there anyone who could help me to make sure that the code indicated by Logit can check the existence of the emails indicated in a column (like the first one) automatically?
 
Status
Not open for further replies.
Back
Top