Search The ForumSearch   RegisterRegister  LoginLogin

MailBee SMTP

 AfterLogic Forum : MailBee SMTP
Subject Topic: Handling invalid addresses Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
reaan
Newbie
Newbie


Joined: 28 August 2007
Location: South Africa
Online Status: Offline
Posts: 3
Posted: 28 August 2007 at 6:19am | IP Logged Quote reaan

Hello

Thank you for a great product which has been working excellently and easily so far.

I'm having some problems with invalid e-mail addresses. If I try to send a message with multiple recipients, and one of the recipient addresses is rejected by the server, the message won't send. Using ValidateEmailAddress(str_Address, 1) works on some of my clients' computers, but not all, and it's very slow.

I don't want to send the message to each recipient separately, since the message may have attachments and multiple messages would be too slow.

Is it possible to modify your product so that I can choose to have invalid addresses ignored? Even better would be if it could provide a list of the addresses ignored. This should be a simple modification, and a very welcome one.

For example, I would like to do:

Dim SMTPserver As MailBee.SMTP
Set SMTPserver = New MailBee.SMTP

'...
'Code to prepare message
'...

With SMTPserver
.IgnoreInvalidAddresses = True
.Send
    
Dim str_InvalidAddresses As String
str_InvalidAddresses = .IgnoredAddresses
End With

Reaan
Back to Top View reaan's Profile Search for other posts by reaan
 
Andrew
AfterLogic Support
AfterLogic Support


Joined: 28 April 2006
Location: United States
Online Status: Offline
Posts: 1189
Posted: 28 August 2007 at 7:09am | IP Logged Quote Andrew

Actually, messages addressed to non-existent recipients are rejected by mail server, so if you have access to your mail server configuration, you may disable validating recipients and the mail server will accept messages addressed to any recipients.

However, we'll research if it's possible to implement a workaround to ignore invalid recipients in MailBee Objects or getting a list of invalid recipients.


Best regards,
Andrew
Back to Top View Andrew's Profile Search for other posts by Andrew
 
reaan
Newbie
Newbie


Joined: 28 August 2007
Location: South Africa
Online Status: Offline
Posts: 3
Posted: 29 August 2007 at 12:16am | IP Logged Quote reaan

Thanks for your reply, Andrew.

Unfortunately, I don't have access to the servers. My app is mostly used with ISP mail servers.

I'd appreciate any other suggestions or tips.

Reaan
Back to Top View reaan's Profile Search for other posts by reaan
 
Alex
AfterLogic Support
AfterLogic Support
Avatar

Joined: 19 November 2003
Online Status: Offline
Posts: 2206
Posted: 29 August 2007 at 10:00am | IP Logged Quote Alex

You may try to use ValidateEmailAddress(EmailAddress, 0) for each address to check syntax (it's quick) and then use SMTP.GetRelayServerFromEmailAddress(EmailAddress) to check if the host name can be found. GetRelayServerFromEmailAddress also supports other parameters which can be used to make it execute faster (however, it may be less reliable in the case if your DNS server is slow):
Code:

GetRelayServerFromEmailAddress(EmailAddress As String, DNSServer As String, SingleAttemptOnly As Boolean, Timeout As Long)

Timeout is in seconds (1 is minimum). DNS Server is IP of your DNS server (if you leave it empty, MailBee will try all the DNS servers registered on your computer one-by-one). However, if SingleAttemptOnly is true, only a single attempt will be made. Thus, the fastest codepath is:
Code:

GetRelayServerFromEmailAddress(EmailAddress, "", True, 1)


If you have multiple recipients, you can first used a method like Message.GetPureAddr (or Message.PureToAddr/PureССAddr properties if your recipients are in To/CC) and then Split(PureAddr, " ,") function to get an array of recipients. Then, you should call ValidateEmailAddress and GetRelayServerFromEmailAddress for each recipient.

However, there is no guarentee this will go faster than findind out bad recipients directly during sending. This is because your SMTP server may use the same routines for this. There is no common way to determine if the address belongs to non-existent domain except than to try to connect to the DNS server for this domain, than to connect to SMTP server on that domain, wait for some time (pretty long for reliability in the case of slow but existent servers) and only then decide. This is how basic TCP/IP (even not high-level SMTP) works.

Regards,
Alex
Back to Top View Alex's Profile Search for other posts by Alex
 
reaan
Newbie
Newbie


Joined: 28 August 2007
Location: South Africa
Online Status: Offline
Posts: 3
Posted: 30 August 2007 at 1:19am | IP Logged Quote reaan

Thanks, Alex!

I was already using ValidateEmailAddress, but the addition of GetRelayServerFromEmailAddress seems to work well.

I'd still like to see the requested modifications in a future version, but, for now, I'm satisfied.

Thanks for your help

Reaan
Back to Top View reaan's Profile Search for other posts by reaan
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump

Powered by Web Wiz Forums version 7.9
Copyright ©2001-2004 Web Wiz Guide