Send Multiple email adresses with hb_SendMail

HMG Samples and Enhancements

Moderator: Rathinagiri

Post Reply
User avatar
WimS
Posts: 5
Joined: Fri Feb 14, 2014 8:47 pm
Location: The Netherlands
Contact:

Send Multiple email adresses with hb_SendMail

Post by WimS »

Hi HMG people,

I made a generic small and simple function to fill in email-adresses in the usual way (with ...; ....; ...) and
convert it to an array.
It can be used in combination with hb_SendMail.
The parameters To, CC or BCC can first be send to this routine with
email_adress_validation(To_variable)

Maybe it is useful for someone?

Kind Regards,

Wim S


*-----EMAIL_ADRESS_VALIDATION-----
FUNCTION Email_adress_validation
PARAMETERS adress_string
LOCAL string_counter , array_counter
LOCAL adress_array := {}
string_counter = 1
array_counter = 1
AADD(adress_array,1)
adress_array[1] = ""
FOR string_counter = 1 TO LEN(adress_string)
DO CASE
CASE UPPER(SUBSTR(adress_string,string_counter,1)) $ "ABCDEFGHIJKLMNOPQRSTUVWXYZ_1234567890-.@"
adress_array[array_counter] := adress_array[array_counter] + SUBSTR(adress_string,string_counter,1)
CASE UPPER(SUBSTR(adress_string,string_counter,1)) $ ";,"
array_counter := array_counter + 1
AADD(adress_array,array_counter)
adress_array[array_counter] := ""
CASE UPPER(SUBSTR(adress_string,string_counter,1)) $ " "
* no action
OTHERWISE
MsgInfo("Email adress contains illegal character: " +SUBSTR(adress_string,string_counter,1))
string_counter := LEN(adress_string)
array_counter := 0
ENDCASE
NEXT teller
RETURN(if(array_counter = 0,"",adress_array))
*-----EOF-EMAIL_ADRESS_VALIDATION-----
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Send Multiple email adresses with hb_SendMail

Post by Javier Tovar »

Gracias Wim S por compartir,

Saludos
EduardoLuis
Posts: 682
Joined: Tue Jun 04, 2013 6:33 pm
Location: Argentina

Re: Send Multiple email adresses with hb_SendMail

Post by EduardoLuis »

Gracias por compartir
Thanks for share.
ASESORMIX
Posts: 190
Joined: Thu Oct 25, 2012 8:08 pm
Location: Bqto, Venezuela

Re: Send Multiple email adresses with hb_SendMail

Post by ASESORMIX »

Gracias por compartir tu esfuerzo y dedicación...

Thanks for sharing your hard work and dedication ..
User avatar
serge_girard
Posts: 3161
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Send Multiple email adresses with hb_SendMail

Post by serge_girard »

Wim,

Thanks for sharing!

I was already looking for an emailaddress-test-routine.

Regretfully there are some lacks:

1) It doesn't allow addresses with 'strange' chars: eg: FRANçOIS@SOMETHING.COM
2) It accepts addresses like: FRANK@SOMETHING;COM (;) FRANK@SOMETHING (without dot and without extension)
3) Some 'strange' chars are allowed in the first part (localpart) and most 'strange' chars are NOT allowed in the domainpart: x^x@something.uk is a valid emailaddres but something@x^x.uk is NOT valid.
4) Some chars are not allowed as first char and some are not allowed as last char.... .sg@something.uk is NOT allowed nor is sg@something.uk.

Best way is to split an emailaddress into 4 parts and then check each part:
- localpart
- @
- domainpart
- extension

http://en.wikipedia.org/wiki/Email_address" onclick="window.open(this.href);return false; gives a little information about this subject but is not complete!


Greetings, Serge/Belgium
There's nothing you can do that can't be done...
Post Reply