Strange behaviour of "bcc" in email sender

Enonic version: 6.5.2
OS: Windows 7 x64

I have found strange behaviour when adding “bcc” to the object for mail sending, you are not getting any mails on “bcc” adresses. I have digged into it and found that my “bcc” is not send to SMTP like “RCPT TO”.

And if you will try to do it like in example:

    return mail.send({
        from: 'Sales Department <sales@enonic.com>',
        to: 'Youvko@gmail.com',
        subject: 'Email Test from Enonic XP',
        cc: ['other@enonic.com'],
        bcc: ['originyouvko@gmail.com', 'other@enonic.com'],
        replyTo: 'support@enonic.com',
        body: 'Welcome to Enonic XP!' + '\r\n\r\n' + '- The Dev Team',
        headers: {
            'Disposition-Notification-To': 'me@enonic.com'
        }
    });

you will get such SMTP logs:

220 localhost smtp4dev ready
EHLO AYOUVKO-NN.infopulse.local
250-Nice to meet you.
250-8BITMIME
250-STARTTLS
250-AUTH=CRAM-MD5 PLAIN LOGIN ANONYMOUS
250-AUTH CRAM-MD5 PLAIN LOGIN ANONYMOUS
250 SIZE
MAIL FROM:sales@enonic.com
250 Okey dokey
RCPT TO:Youvko@gmail.com
250 Recipient accepted
DATA
354 End message with period
From: Sales Department sales@enonic.com
Reply-To: support@enonic.com
To: Youvko@gmail.com
Cc: other@example.org
Message-ID: 614689189.4.1465813381497.JavaMail.Alexander.Youvko@AYOUVKO-NN
Subject: Email Test from Enonic XP
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Disposition-Notification-To: me@enonic.com

Welcome to Enonic XP!

  • The Dev Team
    .
    250 Mail accepted
    QUIT
    221 See you later aligator

More of that I have looked into source files for 6.5.2 version(and 6.7), and found that you adding only message.getRecipients( Message.RecipientType.TO ); to Transport.send() call, but not all getAllRecipients();

Exactly the same situation with “cc” field, it set in “data” section of smtp command, but not set in RCPT TO section. Seems to be that is why messages are not going to cc or bcc.

You are right We should call getAllRecipients() instead.
We will fix this in the 6.6 release.
Good catch!

1 Like

Do you have any aproximate date for future 6.6 release? :slight_smile: I see that you already have first release candidate for 6.6 on GitHub https://github.com/enonic/xp/releases.

I believe the plan is to release it this week :slight_smile:

2 Likes

Enonic XP 6.6 was released on June 29th, so I will close this topic.