Email message and bad address destination

Hello, I develop a web app wich send e-mail
to complete some operations. It work properly if the destination address are correct…

The problem is:
If I have the bad destination e-mail address,
the application with some email provider try an infinite cycle delivering mail
and the antispam of provider ( close the service for all other correct address e-mail and block definitively service.

The method i use is:

Dim mail as emailMessage
dim socket1 As new SMTPSocket
// set up the socket–Socket1 is an SMTPSocket
socket1.address = App.ServerEmailAmmin //sender host
socket1.port = 25

socket1.username = App.UserEmailAmmin //are app properties
socket1.password = App.pwEmailAmmin

mail = new EmailMessage

mail.bodyPlainText = testo
mail.BodyHTML = testo
//mail.bodyHTML = htmlFld.text
mail.headers.appendHeader "Mail_From Marco","autogestione_Marco"

mail.AddRecipient App.DestinEMAmmin

// send the email
socket1.messages.append mail
//progressBar1.visible = True


end try [/code]

Can you help me to find a solution how can I to check correct e-mail address first to send or block delivering cycle for bad destination?
Thank You for help

MBS Solution. German Example:

[code]Function IstEmailAdresse(EmailAdresse As String, Optional DNSCheck As Boolean = True) As String
Dim n As Integer = VerifyEmailMBS(EmailAdresse, DNSCheck)

if n <> 0 then

Select Case n
Case 1
  Return "Ungültige Zeichen im lokalen Teil."
Case 2
  Return "Fehlender Punkt im lokalen Teil."
Case 3
  Return "Ungültige Zeichen im lokalen Teil."
Case 4
  Return "Nicht Escaped Zeichen im lokalen Teil."
Case 5
  Return "Kein lokaler Teil."
Case 6
  Return "Punkt vor dem @ Zeichen."
Case 7
  Return "Keine Domäne in Email Adresse."
Case 8
  Return "Domäne startet mit Punkt."
Case 9
  Return "Domäne darf keine 2 Punkte haben."
Case 10
  Return "Ungültiges Zeichen in Domäne."
Case 11
  Return "Sonderzeichen in Domäne."
Case 12
  Return "Kein Punkt in Domäne."
Case 13
  Return "Domänenname ist länger als erlaubt."
Case 14
  Return "DNS konnte keinen Mailserver für die Domäne finden."
Case 15
  Return "DNS konnte keinen Mailserver für die Domäne finden."
Case 16
  Return "DNS konnte keinen Mailserver für die Domäne finden."
End Select

end if

Return “”
End Function

can I avoid to use MBS?

Do you capture SMTPSecureSocket. ServerError? This could prevent cycling and final ban.

There are various workarounds you can do before. First it might be useful to detect Bots & Co. on public accessible forms or mail functions. I am not talking about captchas (I hate them!) there are several other ways to prove carbon beings.

Second: Basic Checks against typos. Try to detect @-char, Top-Level Domain, Spaces etc.

And last method would be ping or better DNS Check the extracted Top-Level Domain on its MX mail handler. This could be done via console commands (search result for keywords like “not found”) or TCPSocket on port 25, if you’re recieving any data or if a connection is established, then you have a chance to have a valid Email Address.

Thank You Thomas,

can You gently post an example
to capture the SMTPSocket. Server Error?

Thank You

Use EmailSSLExample from built-in Examples (folder Communication/Internet/EmailSSLExample) there you can see an Mailsocket Control in DemoWindow capturing ServerError.

One problem you ha is that you are creating the socket1 variable in the same routine as where you are using it. SMTPSocket runs asynchronously when you call the SendMail method and in your case is going out of scope before it can complete.

I am also very surprised that your provider requires a username and passed, but does not require a secure connection. You may want to check on that if your email provider is out n the Internet somewhere.

Just out of curiosity, how do you know that it’s going into an “infinite cycle?”

Hello Greg,

-> where is the right place to create the socket? <-

To discover the infinite cycle:
I used the web app,
all function right for a month, but a day, all e-mail
of my account I used to send e-mail reject all outgoing message, with ERROR: User Disabled
there I write to postmaster and tell him my problem to send email. He usually do not respond,
but after my help-e-mail account gone ok.

After three time the postmaster
tell-me: the recipient do not exist and there I finally find the problem: a bad destination e-mail address …

Thank you for Help

PS: He tell-me receive 856 mail with bad destination address…

but seeing my log of my app, just 1 message send…

Ok. You really need to implement the events on the SMTPSocket and check for errors then. The socket is most likely sending errors back that you could catch. Also, unless you have created 856 emails to the same bad address, I don’t see how your code would have done this. The framework does not resend emails that have failed.

Marco please try the given XOJO Example Demo and as Greg said, try to cap the SMTPSocket events. Nevertheless your email provider is strange when blocking your email account because of this. I mean 856 mails still are nothing, at least no reason to enforce such a strict policy.

This reminds me to an Microsoft POP3Connector for Exchange gone wild. It was once included in MS Small Business Server 2003 and due an error it sent a huge amount of emails to all recipients (approx 120.000 per hour). At these numbers I would understand such policy.

Thank You Greg and Tomas,
I see the example of Xojo, but i do not find into library the mail socket…

For Desktop application I find TCP socket but it is different to the MailSocket of the example…
I do not understand how can I find this…!

Now I am very confused…