Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Sending email template by code based on template

(0) ShareShare
ReportReport
Posted on by

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
    293,043 Super User 2025 Season 1 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
    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
    8,816 Moderator 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
    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
    1,502 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
    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
    1,502 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
    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
    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
    293,043 Super User 2025 Season 1 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?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,043 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,864 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Product updates

Dynamics 365 release plans