Page 1 of 1

Send Multiple email adresses with hb_SendMail

Posted: Fri Mar 21, 2014 9:11 pm
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-----

Re: Send Multiple email adresses with hb_SendMail

Posted: Fri Mar 21, 2014 9:39 pm
by Javier Tovar
Gracias Wim S por compartir,

Saludos

Re: Send Multiple email adresses with hb_SendMail

Posted: Fri Mar 21, 2014 10:08 pm
by EduardoLuis
Gracias por compartir
Thanks for share.

Re: Send Multiple email adresses with hb_SendMail

Posted: Sat Mar 22, 2014 10:56 am
by ASESORMIX
Gracias por compartir tu esfuerzo y dedicación...

Thanks for sharing your hard work and dedication ..

Re: Send Multiple email adresses with hb_SendMail

Posted: Mon Mar 24, 2014 10:40 am
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