layswan
24th March 2014, 06:38
Hi,

I have a customization session need to send email to multiple recipients. Does anyone know how to write the code? :(

Thanks !

bhushanchanda
24th March 2014, 09:57
Hi,

There are multiple options to send email. You can use blat, or unix commands etc to do that. Search for send email on baanboard to get the related threads.

layswan
24th March 2014, 10:01
Hi,

Below is the code that i wrote to send email to 1 person but how to write the correct code to send to multiple recipients?

to.ID = cmf.createRecipient(message.ID, ttcmf.role.to)
ret = cmf.setRecipientName(to.ID, recipient.name.to)
ret = cmf.setRecipientAddress(to.ID, recipient.address.to)
ret = cmf.setRecipientType(to.ID, "SMTP")
ret = cmf.setRecipientResponsibility(to.ID, "TRUE")

thanks!

bhushanchanda
24th March 2014, 10:59
Hi,

Check this Thread! (http://www.baanboard.com/baanboard/showthread.php?p=161628)

I don't use cmf so never done that. But, you can try the mentioned things.

shah_bs
24th March 2014, 18:42
Conceptually, you should be able to 'assemble' the Recipient list as a SEMI-COLON separate list of names - I am no expert on this, but there must be a limit to how long.

For example:

Assuming that recipient.address.to is a STRING type:

recipient.address.to = "name.lname@company.com; name2.lname2@company.com"

should send to the two people.

If this is how you have to do this.

benito
24th March 2014, 20:54
You can have comma separated email address at email.addr.

function extern send.assign.email( domain tcmcs.str3 i.apgr,
domain tcorno i.ncmr,
domain tcitem i.item,
domain tcdsca i.desc,
domain qmncm.slvl i.slvl,
domain qmncm.mrbc i.mrbc,
domain qmncm.orgn i.orgn,
domain tctxtn i.nctx)
{
string str.subject(100)
string email.body(4096)

|email.addr = "noname@mydomain.com"
email.addr = trim$(xxncm002.emal)
get.desc(qmncm100.item)
str.subject = "Assigned, " & trim$(i.ncmr) & ", " & trim$(i.item) & ", " & trim$(i.desc) & ", " & i.slvl

email.body = "N # " & trim$(i.ncmr) & " had been assigned."

| create temp file for email body
bodyname = creat.tmp.file$(bse.tmp.dir$())

| write email body
fp = seq.open(bodyname, "w")
seq.puts(email.body, fp)
seq.close(fp)

| send the email via unix 'mailx' command

ret = run.prog("mailx",
"-s " & quoted.string(str.subject) & " -r 'no.reply@mydomain.com' " & email.addr,
RP_WAIT,
bodyname,
"",
"")

| remove email body file
seq.unlink(bodyname)
}

bhushanchanda
25th March 2014, 09:31
Hi,

CMF has a limit of I guess around 132 characters. Though, you can build a function to send email something like

send_email(domain tcmcs.str109 id)

and call the function to send mails to multiple recipients by passing the email addresses to this function like

send_email("addr_1;addr_2")
send_email("addr_3;addr_4")

NPRao
25th March 2014, 20:57
You can create cc and bcc recipients using - cmf.createRecipient() (http://www.baanboard.com/programmers_manual_baanerp_help_emessage_connector_cmf_createrecipient)