title: sp_db_sendmail error
body: <p>I am currently running SQL Server 2014 and trying to execute a stored procedure that sends out an email using sp_db_sendmail which is failing with the following error.</p>
  
  <blockquote>
    <p>An error occurred in the Microsoft .NET Framework while trying to load
    assembly id 65549. The server may be running out of resources, or the
    assembly may not be trusted with PERMISSION_SET = EXTERNAL_ACCESS or
    UNSAFE. Run the query again, or check documentation to see how to
    solve the assembly trust issues. For more information about this
    error:  System.IO.FileLoadException: Could not load file or assembly
    'sqlwebrequest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'
    or one of its dependencies. An error relating to security occurred.
    (Exception from HRESULT: 0x8013150A) System.IO.FileLoadException:<br>
    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName,
    String codeBase, Evidence assemblySecurity, RuntimeAssembly
    locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder,
    Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean
    suppressSecurityChecks)    at
    System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName
    assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly,
    StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean
    throwOnFileNotFound, Boolean forIntrospection, Boolean
    suppressSecurityChecks)    at
    System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,
    Evidence assemblySecurity, StackCrawlMark&amp; stackMark, IntPtr
    pPrivHostBinder, Boolean forIntrospection)    at
    System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString,
    Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean
    forIntrospection)    at System.Reflection.Assembly.Load(String
    assemblyString)</p>
  </blockquote>
  
  <p>Originally the sp_db_sendmail was working but since moving the database that calls the code to a new server I am getting the above message.</p>
  
  <p>I have made the owner of the database the same as it was on the original server "sa" and also set the database to be "Trustworthy" which seems according to relevant googling should fix the problem, but still no luck.</p>
  
  <p>Any further suggestion would be appreciated.</p>