I am using Lansa Integrator's SMTPMailService to send an e-mail to hundreds of recipients. I have made a working list where the e-mail adresses are stored. Then I've put all the e-mail addresses in the BCC field so that I only have to send one e-mail instead of hundreds of individual e-mails.
When I use this method from within a reusable part in a Windows application sometimes there is an error like 'invalid email address'. I'm sure all the selected e-mail addresses in the list are correct so that shouldn't be an issue here. It happens when I select a large amount of e-mail addresses at once. A smaller amount of email address are processed just fine.
I was wondering if there was a maximum length of data in a BCC field? So when those hundreds of email adresses get concatenated like: email1@domain.com;email2@domain.com;email3@domain.com etc. then when the maximum length is reached, the last e-mail address would be cut off resulting in the last e-mail address to be invalid.
I've taken some of the source code that I use below:
Code: Select all
Def_List Name(#WL_EMLADR) Fields(#BLEEMA) Type(*WORKING) Entrys(9999)
* Set sender (FROM:)
Case Of_Field(#USER)
* Klokteam users
When Value_Is('= GRTPPR' '= GRTPPIZ' '= GRTPAVG' '= GRTPEC' '= GRTAEC' '= GRTAPIZ' '= GRTAPR' '= GRTAAVG')
#GRBEML := *Z03_EML_KLOK
Otherwise
#GRBEML := *Z03_EML_ZON
Endcase
Use Builtin(TCONCAT) With_Args('SET FROM(' #GRBEML ')') To_Get(#JSMCMD)
Use Builtin(JSMX_COMMAND) With_Args(#JSMHDNL #JSMCMD) To_Get(#JSMSTS #JSMMSG)
Execute Subroutine(CHECK_JSM) With_Parms(#JSMSTS #JSMMSG)
* Set addressed (TO:)
Clr_List Named(#WL_EMLADR)
Change Field(#BLEEMA) To(*Z03_EML_KLOK)
Add_Entry To_List(#WL_EMLADR)
Use Builtin(JSMX_COMMAND) With_Args(#JSMHDNL 'SET TO(*LIST) SERVICE_LIST(BLEEMA)') To_Get(#JSMSTS #JSMMSG #WL_EMLADR)
Execute Subroutine(CHECK_JSM) With_Parms(#JSMSTS #JSMMSG)
* Send email to selected clients (as BCC)
Clr_List Named(#WL_EMLADR)
Selectlist Named(#LTVW_MAIL)
Continue If(#LTVW_MAIL.CurrentItem.Checked ^= True)
Change Field(#BLEEMA) To(#GRJEML)
Add_Entry To_List(#WL_EMLADR)
Endselect
* Set Blind Carbon Copy (BCC:)
Use Builtin(JSMX_COMMAND) With_Args(#JSMHDNL 'SET BCC(*LIST) SERVICE_LIST(BLEEMA)') To_Get(#JSMSTS #JSMMSG #WL_EMLADR)
Execute Subroutine(CHECK_JSM) With_Parms(#JSMSTS #JSMMSG)
* Set subject (RE:)
#EMLSUBJ := #STD_TEXTL
Use Builtin(TCONCAT) With_Args('SEND SUBJECT(' #EMLSUBJ ') SERVICE_LIST(AEAOPM)') To_Get(#JSMCMD)
Use Builtin(JSMX_COMMAND) With_Args(#JSMHDNL #JSMCMD) To_Get(#JSMSTS #JSMMSG #MEMO_BODY)
Execute Subroutine(CHECK_JSM) With_Parms(#JSMSTS #JSMMSG)