web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

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

  • Bhalchandra Pawar Profile Picture
    15 on at

    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;

                   }

               }

           }

       }

    }

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    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.

  • meelamri Profile Picture
    13,216 User Group Leader on at

    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..

  • Bhalchandra Pawar Profile Picture
    15 on at

    Thanks Mehedi, It helped a lot..

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Martin Dráb Profile Picture

Martin Dráb 49 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 38 Super User 2025 Season 2

#3
#ManoVerse Profile Picture

#ManoVerse 31

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans