Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Sending email template by code based on template

Posted on by 11,871

I have a code sending email with attachment based email template , the issue is that a copy of the email is sent to the email specified as sender , how can I stop this ?

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 287,696 Super User on at
    RE: Sending email template by code based on template

    Hi Maram,

    Is the recipient a shared email box or a natural person? Is it an internal or external person? Could it be a setting on your Exchange Server or Office 365?

  • maram fraij Profile Picture
    maram fraij 11,871 on at
    RE: Sending email template by code based on template

    Hi ergun sahin ,

    no customization on sysEmailDistributor

    But I think ( but not sure just a guessing) that there is a property on the system level makes email distributor send a copy to sender or may be at email template I check different parts but until now I cannot find anything

  • ergun sahin Profile Picture
    ergun sahin 8,812 Super User on at
    RE: Sending email template by code based on template

    Hi Maram,

    I can't see anything that would require sending it twice in this code.

    Maybe a customization caused this. Can you check the SysOutgoingEmailTable (or data) table for copied records.

    Do you have a workflow in the template.

    You can try with othter templates or without any template.

    You can insert data with other status.

    You can look sysEmailDistributor class for any customization

  • maram fraij Profile Picture
    maram fraij 11,871 on at
    RE: Sending email template by code based on template

    its select not while select so even if there is two records only one record will be processed .

  • Jay Barot Profile Picture
    Jay Barot 1,500 on at
    RE: Sending email template by code based on template

    Screenshot_5F00_20200607_2D00_163024_7E00_2.png

    i was talking about this. 

  • maram fraij Profile Picture
    maram fraij 11,871 on at
    RE: Sending email template by code based on template

    Hi Jay,

    I do not have any join query in my code

  • Suggested answer
    Jay Barot Profile Picture
    Jay Barot 1,500 on at
    RE: Sending email template by code based on template

    Hi Maram,

    Can you check the joins used in code. Either it's getting 2 records because 2 conditions for emailId field.

  • maram fraij Profile Picture
    maram fraij 11,871 on at
    RE: Sending email template by code based on template

    Hi Ludwig ,

    I have custom report convert to pdf and and I send it to worker . This part works correctly but the issue is that the sender also receives a copy from the same email.

    Environment is D365FO

  • maram fraij Profile Picture
    maram fraij 11,871 on at
    RE: Sending email template by code based on template

    Hi André ,

    _emailAddr contains the email of  the user linked with certain worker and yes I am sure that it contains only one email . if the method called more than one time I expect that the receiver will receive multiples email not the email sent to different receivers  

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 287,696 Super User on at
    RE: Sending email template by code based on template

    Hi Maram,

    What is the value provided in the variable '_emailAddr'? Is this containing one or multiple addresses? Did you check using the debugger how many times this method is being executed?

Helpful resources

Quick Links

Replay now available! Dynamics 365 Community Call (CRM Edition)

Catch up on the first D365 Community Call held on 7/10

Community Spotlight of the Month

Kudos to Saurav Dhyani!

Congratulations to the June Top 10 community leaders!

These stars go above and beyond . . .

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 287,696 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 225,490 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans