Berkay
Berkay

Reputation: 55

How can I send an email with bcc receipents in Dynamics Ax2009

I am sending a batch mail and I want to send a copy (bcc) to an admin mail group. Is it possible to send mail to a bcc receipent in AX 2009?

Thanks in advance.

Upvotes: 1

Views: 2300

Answers (2)

Donatas
Donatas

Reputation: 421

I'm not sure about AX 2009, but in AX 2012 you can reuse methods tos() and ccs() and create new ones (tosBccs() and bccs()) like so:

SysMailerAddressField tosBCC()
{
    ;
    return  SysMailerAddressField::create(_com, SysmailerAddressFieldType::Bcc);
}

SysMailerAddressField bccs()
{
    InteropPermission permission = new InteropPermission(InteropKind::ComInterop);

    permission.assert();

    //BP Deviation Documented
    return SysMailerAddressField::create(_com,SysmailerAddressFieldType::Bcc);
}

Now, in your email code, where you use SysMailer object you can call above functionality:

SMTPUserName _bccAddress;
;
if(_bccAddress != "")
{
    mailer.tosBCC().appendAddress(_bccAddress);            
}

Here you can find a full example (you may need to use Google Translate though). I'm pretty sure that should work in AX 2009 too.

Upvotes: 1

Berkay
Berkay

Reputation: 55

I think I have found the solution. If I use SysMailer class it has bccs method. There is a SysMailer example use here.

Upvotes: 0

Related Questions