Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Getting error while calling AWS simple email from plugin

(0) ShareShare
ReportReport
Posted on by 15

Getting below errorr  while calling AWS simple email from plugin

Exception Message: An unexpected error occurred from ISV code. (ErrorType = ClientError) Unexpected exception from plug-in (Execute): PluginDemo.SendMail: System.Exception: Could not load file or assembly 'AWSSDK.SimpleEmail, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604' or one of its dependencies. The system cannot find the file specified.

ErrorCode: -2147220956
HexErrorCode: 0x80040224

  • Bhalchandra Pawar Profile Picture
    15 on at
    RE: Getting error while calling AWS simple email from plugin

    Thanks Mehedi, It helped a lot..

  • meelamri Profile Picture
    13,212 User Group Leader on at
    RE: Getting error while calling AWS simple email from plugin

    Hi Bhalchandra,Andrew

    Release 1 2021 announces the possibility of including additional dependent assemblies with their plug-in assemblies when registering a plug-in on the Microsoft Dataverse server:

    docs.microsoft.com/.../dependent-assemblies-plug-ins

    I hope to be able to use this new feature very soon. It will save us from using ILMerge Utility..

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Getting error while calling AWS simple email from plugin

    Can you please provide screenshot with project references as I asked in the previous reply?

    My assumption is that your code references some libraries from Amazon that are not available in the sandbox. It seems that you will have to use ILMerge to add it to the resulting package - nishantrana.me/.../

    Good luck.

  • Bhalchandra Pawar Profile Picture
    15 on at
    RE: Getting error while calling AWS simple email from plugin

    Thanks Andrew, 

    5545.Capture.PNG

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Text;

    using System.Threading.Tasks;

    using System.Configuration;

    using Microsoft.Xrm.Sdk;

    using Microsoft.Crm.Sdk;

    using Microsoft.Xrm.Sdk.Query;

    using Microsoft.Xrm.Sdk.WebServiceClient;

    using Microsoft.Crm.Sdk.Messages;

    using Microsoft.Xrm.Tooling.Connector;

    using Amazon;

    using Amazon.SimpleEmail;

    using Amazon.SimpleEmail.Model;

    using MimeKit;

    using System.IO;

    namespace PluginDemo

    {

       public class SendMail : IPlugin

       {

           public void Execute(IServiceProvider serviceProvider)

           {

               using (var client = new AmazonSimpleEmailServiceClient("AwsKeyId","AwsSecretAccessKey", RegionEndpoint.USEast1))

               using (var messageStream = new MemoryStream())

               {

                   var message = new MimeMessage();

                   var builder = new BodyBuilder() { TextBody = "Hello World" };

                   message.From.Add(new MailboxAddress("bhalchandra", "bhalchandra.pawar@gmail.com"));

                   message.To.Add(new MailboxAddress("bhalchandra", "bhalchandra.pawar@gmail.com"));

                   message.Subject = "Hello World";

                   message.Body = builder.ToMessageBody();

                   message.WriteTo(messageStream);

                   var request = new SendRawEmailRequest()

                   {

                       RawMessage = new RawMessage() { Data = messageStream }

                   };

                   try

                   {

                       client.SendRawEmail(request);

                   }

                   catch (Exception ex)

                   {

                       throw ex;

                   }

               }

           }

       }

    }

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at
    RE: Getting error while calling AWS simple email from plugin

    Hello,

    Can you please provide the code you use and a screenshot that displays assemblies referenced by your plugin assembly?

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Jonas ”Jones” Melgaard – Community Spotlight

We are honored to recognize Jonas "Jones" Melgaard as our April 2025…

Kudos to the March 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... 294,261 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 233,013 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,158 Moderator

Leaderboard

Product updates

Dynamics 365 release plans