{"id":11110,"date":"2018-12-07T12:00:49","date_gmt":"2018-12-07T03:00:49","guid":{"rendered":"https:\/\/www.ka-net.org\/blog\/?p=11110"},"modified":"2018-12-07T13:58:51","modified_gmt":"2018-12-07T04:58:51","slug":"powershellmailkit%e3%82%92%e4%bd%bf%e3%81%a3%e3%81%a6%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e4%b8%8a%e3%81%ae%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%92%e7%a2%ba%e8%aa%8d%e3%81%99%e3%82%8b%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.ka-net.org\/blog\/?p=11110","title":{"rendered":"[PowerShell]MailKit\u3092\u4f7f\u3063\u3066\u30b5\u30fc\u30d0\u30fc\u4e0a\u306e\u30e1\u30fc\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5(POP3)"},"content":{"rendered":"<p>\u5148\u65e5\u304b\u3089<a href=\"https:\/\/www.nuget.org\/packages\/MailKit\/\" title=\"NuGet Gallery | MailKit 2.0.7\" target=\"_blank\">MailKit<\/a>\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u9001\u4fe1\u3092\u884c\u3046PowerShell\u306e\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u304d\u307e\u3057\u305f\u3002<\/p>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=11087\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-PowerShell-120x120.png' alt='[PowerShell]MailKit\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u65b9\u6cd5' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2018.11.28<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=11087\">[PowerShell]MailKit\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u65b9\u6cd5 <\/a><\/div><div class=\"cardlink_excerpt\">\uff20IT\u3092\u773a\u3081\u3066\u3044\u305f\u3089\u3001\u6c17\u306b\u306a\u308b\u8a18\u4e8b\u3092\u898b\u304b\u3051\u307e\u3057\u305f\u3002\r\n\r\n\r\n\r\nMailKit\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u9001\u4fe1\u3092\u884c\u3046\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u7d39\u4ecb\u3067\u3059\u304c\u3001\u6c17\u306b\u306a\u3063\u305f\u306e\u306fSmtpClient\u30af\u30e9\u30b9\u306b\u3064\u3044\u3066\u66f8\u304b\u308c\u305f\u90e8\u5206\u3002\r\n\r\n.NET Framework 2.0\u4ee5\u6765\u3001\u30e1\u30fc\u30eb\u9001\u4fe1...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<div class=\"cardlink\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=11104\"><div class=\"cardlink_thumbnail\"><img src='https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-PowerShell-120x120.png' alt='[PowerShell]MailKit\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u6dfb\u4ed8\u3059\u308b\u65b9\u6cd5' width=120 height=120 \/><\/a><\/div><div class=\"cardlink_content\"><span class=\"timestamp\">2018.11.30<\/span><div class=\"cardlink_title\"><a href=\"https:\/\/www.ka-net.org\/blog\/?p=11104\">[PowerShell]MailKit\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u6dfb\u4ed8\u3059\u308b\u65b9\u6cd5 <\/a><\/div><div class=\"cardlink_excerpt\">\u5148\u65e5\u3001PowerShell\u304b\u3089MailKit\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3059\u308b\u65b9\u6cd5\u306b\u3064\u3044\u3066\u8a18\u4e8b\u3092\u66f8\u304d\u307e\u3057\u305f\u3002\r\n\r\n\r\n\r\n\u524d\u56de\u306f\u30c6\u30ad\u30b9\u30c8\u306e\u307f\u306e\u30e1\u30fc\u30eb\u3060\u3063\u305f\u306e\u3067\u3001\u4eca\u56de\u306f\u30d5\u30a1\u30a4\u30eb\u3092\u6dfb\u4ed8\u3057\u305f\u30e1\u30fc\u30eb\u3092\u9001\u4fe1\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002\r\n\r\n\u203b MailKit\u306e\u5c0e\u5165\u65b9\u6cd5\u306f\u300c[Powe...<\/div><\/div><div class=\"cardlink_footer\"><\/div><\/div>\n<p>\u4eca\u5ea6\u306f\u30e1\u30fc\u30eb\u9001\u4fe1\u3067\u306f\u306a\u304f\u3001\u53d7\u4fe1\u5074\u306e\u51e6\u7406\u3092\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">#DLL\u8aad\u307f\u8fbc\u307f\r\n&#x5B;void]&#x5B;System.Reflection.Assembly]::LoadFile(&quot;C:\\System\\MailKit\\MailKit.dll&quot;)\r\n&#x5B;void]&#x5B;System.Reflection.Assembly]::LoadFile(&quot;C:\\System\\MailKit\\MimeKit.dll&quot;)\r\n\r\n#\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u5909\u66f4\r\n$userID = &quot;xxxx@xxxxxxxxxx.onmicrosoft.com&quot;\r\n$userPassword = &quot;(\u30d1\u30b9\u30ef\u30fc\u30c9)&quot;\r\n$mailServer = &quot;outlook.office365.com&quot;\r\n$mailPort = 995\r\n\r\n#\u30e1\u30fc\u30eb\u30b5\u30fc\u30d0\u30fc\u8a2d\u5b9a\r\n$client = New-Object MailKit.Net.Pop3.Pop3Client\r\n$client.Connect($mailServer, $mailPort, &#x5B;MailKit.Security.SecureSocketOptions]::SslOnConnect)\r\n$client.Authenticate($userID, $userPassword)\r\n\r\n#\u30e1\u30fc\u30eb\u306e\u4ef6\u540d\u51fa\u529b\r\nfor($i=0; $i -lt $client.Count; $i++){\r\n  $msg = $client.GetMessage($i)\r\n  &#x5B;System.Console]::WriteLine(&quot;{0}, {1}&quot;, $i, $msg.Subject)\r\n}\r\n\r\n#DeleteMessage\u30e1\u30bd\u30c3\u30c9\u3067\u30e1\u30fc\u30eb\u3092\u524a\u9664\u3059\u308b\u3053\u3068\u3082\u53ef\u80fd\r\n#$client.DeleteMessage($client.Count - 1)\r\n\r\n$client.Disconnect($true)<\/pre>\n<p><a href=\"https:\/\/support.office.com\/ja-jp\/article\/c82de912-adcc-4787-8283-45a1161f3cc3\" title=\"\u30e1\u30fc\u30eb \u30d7\u30ed\u30d0\u30a4\u30c0\u30fc\u304b\u3089\u5165\u624b\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u30b5\u30fc\u30d0\u30fc\u306e\u8a2d\u5b9a - Office \u30b5\u30dd\u30fc\u30c8\" target=\"_blank\">Office 365\u306e\u30e1\u30fc\u30eb\u53d7\u4fe1\u30b5\u30fc\u30d0\u30fc<\/a>\u306bPOP\u3067\u63a5\u7d9a\u3057\u3066\u3001\u30b5\u30fc\u30d0\u30fc\u5185\u306b\u3042\u308b\u30e1\u30fc\u30eb\u306e\u4ef6\u540d\u3092\u4e00\u89a7\u8868\u793a\u3059\u308b\u30b3\u30fc\u30c9\u3067\u3059\u3002<\/p>\n<p><a href=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_MailKit_03.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_MailKit_03.jpg\" alt=\"\" width=\"340\" height=\"247\" class=\"alignnone size-full wp-image-11111\" srcset=\"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_MailKit_03.jpg 340w, https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/PowerShell_MailKit_03-300x218.jpg 300w\" sizes=\"auto, (max-width: 340px) 100vw, 340px\" \/><\/a><\/p>\n<p>\u4e0a\u8a18\u30b3\u30fc\u30c9\u3067\u306f\u30e1\u30fc\u30eb\u306e\u4ef6\u540d\u3057\u304b\u53d6\u5f97\u3057\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u5b9b\u5148\u3084\u672c\u6587\u306a\u3069\u3001\u305d\u306e\u4ed6\u306e<a href=\"http:\/\/www.mimekit.net\/docs\/html\/T_MimeKit_MimeMessage.htm\" title=\"MimeMessage Class\" target=\"_blank\">\u30d7\u30ed\u30d1\u30c6\u30a3<\/a>\u3082\u7c21\u5358\u306b\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<div id=\"single_banner_area2\" class=\"clearfix one_banner\">\n<div class=\"single_banner single_banner_left\">\n<script async src=\"https:\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js\"><\/script>\r\n<!-- \u8a18\u4e8b\u4e2d(\u30c7\u30a3\u30b9\u30d7\u30ec\u30a4\u5e83\u544a\u30e6\u30cb\u30c3\u30c8) -->\r\n<ins class=\"adsbygoogle\"\r\n     style=\"display:block\"\r\n     data-ad-client=\"ca-pub-7306936664602087\"\r\n     data-ad-slot=\"5429724765\"\r\n     data-ad-format=\"auto\"\r\n     data-full-width-responsive=\"true\"><\/ins>\r\n<script>\r\n     (adsbygoogle = window.adsbygoogle || []).push({});\r\n<\/script>\n<\/div>\n<div class=\"single_banner single_banner_right\">\n<a href=\"\" target=\"_blank\"><img decoding=\"async\" src=\"\" alt=\"\" title=\"\" \/><\/a>\n<\/div>\n<\/div>\n\n<p><a href=\"https:\/\/www.nuget.org\/packages\/MailKit\/\" title=\"NuGet Gallery | MailKit 2.0.7\" target=\"_blank\">MailKit<\/a>\u3001\u307b\u3093\u306e\u5c11\u3057\u3057\u304b\u89e6\u3063\u3066\u3044\u307e\u305b\u3093\u304c\u3001\u304a\u624b\u8efd\u3067\u4f7f\u3044\u52dd\u624b\u304c\u826f\u304f\u3001\u304b\u306a\u308a\u4fbf\u5229\u3060\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5148\u65e5\u304b\u3089MailKit\u3092\u4f7f\u3063\u3066\u30e1\u30fc\u30eb\u9001\u4fe1\u3092\u884c\u3046PowerShell\u306e\u30b3\u30fc\u30c9\u306b\u3064\u3044\u3066\u8a18\u4e8b\u3092\u66f8\u3044\u3066\u304d\u307e\u3057\u305f\u3002 \u4eca\u5ea6\u306f\u30e1\u30fc\u30eb\u9001\u4fe1\u3067\u306f\u306a\u304f\u3001\u53d7\u4fe1\u5074\u306e\u51e6\u7406\u3092\u8a66\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002 #DLL\u8aad\u307f\u8fbc\u307f &#x5B;void]&#038;#x5 [&hellip;]","protected":false},"author":1,"featured_media":7127,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"[[PowerShell]MailKit\u3092\u4f7f\u3063\u3066\u30b5\u30fc\u30d0\u30fc\u4e0a\u306e\u30e1\u30fc\u30eb\u3092\u78ba\u8a8d\u3059\u308b\u65b9\u6cd5(POP3)]","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[94],"tags":[],"class_list":["post-11110","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"aioseo_notices":[],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/www.ka-net.org\/blog\/wp-content\/uploads\/eyecatch-PowerShell.png","jetpack_shortlink":"https:\/\/wp.me\/p4UZZr-2Tc","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11110","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=11110"}],"version-history":[{"count":2,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11110\/revisions"}],"predecessor-version":[{"id":11113,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/11110\/revisions\/11113"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=\/wp\/v2\/media\/7127"}],"wp:attachment":[{"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=11110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=11110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ka-net.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=11110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}