How Do I Create a BCC Message?

When adding the "bcc" functionality to the messages, the impact or the load on the nodes would be directly proportional to the number of messages and the average number of "bcc" recipients in each message. For example, if the expected sending rate is 1M/hour and there is just one recipient in "bcc", the Momentum MTA nodes would be effectively handling 2M/hour traffic (2X load). Basically these messages injected from "bcc" are like any normal message injections and multiple "bcc" recipients can be added.

The following is a lua sample which depicts basic functionality of adding bcc:

local mod = {};
function mod:validate_data(str, accept, vctx)
  local mc = msys.core.accept_construct_get_message_construct(accept);
  local msg = mc.message;
  local rcptto = msg:rcptto();
    -- print    ("rcptto: ",rcptto);
 if (rcptto == "") then vctx:add_recipient("");
  print ("Added the additional recipient to the oob");
  end    local addrs = vctx:recipient_list();
  -- print ("Recipient list : ",msys.dumper.Dumper(addrs));
  return msys.core.VALIDATE_CONT;
msys.registerModule("blergh", mod);


If a customer is trying to add multiple recipients via a series of LUA if / then / elseif / then statements as follows:

function mod:validate_data(msg,accept, vctx)
    local mc = msys.core.accept_construct_get_message_construct(accept);
    local msg = mc.message;
    local cuid = msg:header("TenantHeader");
    if (cuid[1] == "abcd_123") then
    elseif (cuid[1] == "defg_456") then
    return msys.core.VALIDATE_CONT;

It can be simplified by reading in the data from an external data source. The data can be read from SQL DB, CSV file, ODBC, LDAP etc. using "msys.db" interface in Momentum. The following is an example of reading data from a DB:

local mod = {};
function mod:validate_data_spool_each_rcpt (msg, accept, vctx)
local rowset, row, err;
rowset, err = msys.db.query('devsqldb1', 'select * from sysmembers', {30});
if rowset == nil then
print("ERROR: " .. err);
for row in rowset do
print("Print: MemberUID is: " .. row.memberuid .. " GroupUID is: " .. row.groupuid);
return msys.core.VALIDATE_CONT;
msys.registerModule("odbc_test", mod);
  1. When this is implemented via a LUA script, if the functionality is basic i.e. just adding the recipients, there wouldn't be much processing overhead involved. But if there are a high number of custom LUA scripts in place for these messages, there might be a slight overhead. Based on the estimated sending volume, the MTA nodes should be having enough resources to handle this volume i.e. CPUs available, Memory, Disk space and IOPS etc.

  2. If using the standard SMTP injection, you can just add a new RCPT_TO address in the envelope "without" adding it to the "To" header like this:

mail from: rcpt to: rcpt to: DATA To: Subject: Testing bcc

In this case, is automatically a BCC.

  1. Another way to do this is to use the SMTP API. The "smtpapi" module needs to be enabled (two parts: in the smtpapi {} in the smtpapi.conf and within scriptlet stanza for smtpapi.lua). Once you have this configured, the "x-msys-header" can be used to achieve this. Please refer to the following URL for more information about the header:

The BCC recipients can be set like this:

"campaign_id": "my_campaign"
"cc": [
{ "email": "", "name": "CC 1" },
{ "email": "", "name": "CC 2" }
"bcc": [
{ "email": "", "name": "BCC 1" }
{ "email": "", "name": "BCC 2" }

Please find more information here:

Just an FYI, the SMTP API requires the "generation" license.