Child pages
  • [emails] Manually added e-mail recipients not listed in E-mail Log [5.2.1]
Skip to end of metadata
Go to start of metadata

When sending an e-mail the recipients can be specified in the following headers:

  • To
  • Cc
  • Bcc

In In-Portal e-mails are configured via E-mail Templates section, which allows to specify each header value for every e-mail template (in addition to what developer specifies, when sending an e-mail using that template):

Also, when developer is sending new e-mail using that template it's possible to specify extra e-mails, that will be different for each e-mail sent out (e.g. e-mail of user, that performed a registration):

/** @var kEmailSendingHelper $email_sender */
$email_sender = $this->Application->recallObject('EmailSender');
 
// Recipients not present in logs.
$email_sender->AddTo('e-mail', 'first name', 'last name');
...
$email_sender->AddCc('e-mail', 'first name', 'last name');
...
$email_sender->AddBcc('e-mail', 'first name', 'last name');
...
 
// Recipient present in logs.
$this->Application->EmailEventUser('CATEGORY.ADD', null, array(
    'to_name' => 'first name last name',
    'to_email' => 'e-mail',
));
$this->Application->EmailEventUser('CATEGORY.ADD', $user_id);

Unfortunately recipients added through direct calls to $email_sender methods are not listed in the E-mail Log.

Solution

Determine recipient list, that will be shown in E-mail Log section by analyzing actual sent e-mail header values instead of just looking at e-mail template configuration.

Related Tasks

INP-1419 - Getting issue details... STATUS

1 Comment

  1. When I enabled proper logging I've found another interesting side effect: the order of e-mail recipients differs from one used to add them:

    Recipient (sorted by adding order)Recipients (sorted by order in sent e-mail) - expectedRecipients (sorted by order in sent e-mail) - actual
    • email1 (added via "AddTo" method)
    • email2 (specified via "to_email" send param)
    • email3 (specified in e-mail template configuration)
    • email2 (specified via "to_email" send param)
    • email1 (added via "AddTo" method)
    • email3 (specified in e-mail template configuration)
    • email1 (added via "AddTo" method)
    • email2 (specified via "to_email" send param)
    • email3 (specified in e-mail template configuration)

    Because of this (the 1st recipient is in the middle of the list) we have 2 problems:

    • the "To" header in e-mail has wrong recipient order and recipients of e-mail see that
    • way how we're detection other recipients (all but 1st one) no longer works, because it's in the middle