{"id":551,"date":"2010-08-23T12:39:25","date_gmt":"2010-08-23T19:39:25","guid":{"rendered":"http:\/\/45.63.48.66\/?p=551"},"modified":"2019-05-02T14:57:20","modified_gmt":"2019-05-02T21:57:20","slug":"attachments-are-not-released-until-the-microsoft-dynamics-nav-client-is-closed-when-you-use-the-smtp-mail-codeunit-400","status":"publish","type":"post","link":"https:\/\/gotcal.com\/index.php\/2010\/08\/attachments-are-not-released-until-the-microsoft-dynamics-nav-client-is-closed-when-you-use-the-smtp-mail-codeunit-400\/","title":{"rendered":"Attachments are not released until the Microsoft Dynamics NAV client is closed when you use the SMTP mail codeunit (400)"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"alignright size-full wp-image-562\" title=\"patch\" src=\"\/wp-content\/uploads\/2010\/08\/patch.png\" alt=\"\" width=\"299\" height=\"234\">As reported in multiple blogs and user forums, the SMTP component had an issue about locking the files that was attached to sent emails. This usually always caused issues, as you would clean up your temporarily generated files after having sent them with the email attachment.<\/p>\n<p>According to the released hotfix <a href=\"https:\/\/mbs2.microsoft.com\/Knowledgebase\/KBDisplay.aspx?scid=kb$EN-US$2280492&amp;wa=wsignin1.0\">KB2280492<\/a>, this was occurred occurs because Microsoft .NET Framework waits for  the garbage collector to release resources when .NET COM objects are  retained in memory.<\/p>\n<p>Curious as most i looked into the fix they released to see what was actually changed, as it uses some standard .NET components to send the emails with.<\/p>\n<p><!--more-->So to start with lets take a look at the methods of the old old mail component, that had the issue with the GC (garbage collection):<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-553\" title=\"smtpmethods\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/08\/smtpmethods.png\" alt=\"\" width=\"442\" height=\"580\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/08\/smtpmethods.png 442w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/08\/smtpmethods-228x300.png 228w\" sizes=\"auto, (max-width: 442px) 100vw, 442px\" \/><\/p>\n<p>Next lets take a look at the new component to see the methods that has been added to handle overrides for Dispose():<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-554\" title=\"smtpmethodsNEW\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/08\/smtpmethodsNEW.png\" alt=\"\" width=\"329\" height=\"150\" srcset=\"https:\/\/gotcal.com\/wp-content\/uploads\/2010\/08\/smtpmethodsNEW.png 329w, https:\/\/gotcal.com\/wp-content\/uploads\/2010\/08\/smtpmethodsNEW-300x136.png 300w\" sizes=\"auto, (max-width: 329px) 100vw, 329px\" \/><\/p>\n<p>Looking at the specific method you will see this code in the Dispose():<\/p>\n<p><a href=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/08\/code.png\" rel=\"lightbox[551]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-555\" title=\"code\" src=\"http:\/\/45.63.48.66\/wp-content\/uploads\/2010\/08\/code.png\" alt=\"\" width=\"190\" height=\"103\"><\/a><\/p>\n<p>Simple, thanks Microsoft for fixing and thanks to Steffen Brandt for pointing me to this hotfix! Anyways, as you can see it is back to work now &#8211; looking at a week here in southern California with temperatures in the 100&#8217;s, ouch &#8211; going to be fun!<\/p>\n<p>The above &#8220;reflection&#8221; on .NET code is done with Red Gates .NET Reflector tool. I will do a blog posting later this week, on how to use this great tool.<\/p>\n<p>Here is the KB files: [dm]10[\/dm]<\/p>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>As reported in multiple blogs and user forums, the SMTP component had an issue about locking the files that was attached to sent emails. This usually always caused issues, as you would clean up your temporarily generated files after having sent them with the email attachment. According to the released hotfix KB2280492, this was occurred [&hellip;]<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3],"tags":[77,28,39,36],"class_list":["post-551","post","type-post","status-publish","format-standard","hentry","category-navision","tag-navision","tag-external","tag-programming","tag-smtp"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/551","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/comments?post=551"}],"version-history":[{"count":12,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/551\/revisions"}],"predecessor-version":[{"id":1042,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/posts\/551\/revisions\/1042"}],"wp:attachment":[{"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/media?parent=551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/categories?post=551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gotcal.com\/index.php\/wp-json\/wp\/v2\/tags?post=551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}