Home
%3CLINGO-SUB%20id%3D%22lingo-sub-328625%22%20slang%3D%22en-US%22%3ETest%20email%20from%20SharePoint%20using%20PowerShell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-328625%22%20slang%3D%22en-US%22%3E%3CH3%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20inherit%3B%20font-family%3A%20inherit%3B%20font-size%3A%2024px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20normal%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.1%3B%20margin-bottom%3A%2010px%3B%20margin-top%3A%2020px%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20id%3D%22toc-hId-1478787999%22%20id%3D%22toc-hId-1505364517%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%22%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20font-weight%3A%20bold%3B%22%3ESummary%3A%3CBR%20style%3D%22box-sizing%3A%20border-box%3B%22%20%2F%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH3%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3EThe%20following%20PowerShell%20script%20was%20written%20for%26nbsp%3Bmy%20%3CA%20style%3D%22background-color%3A%20transparent%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23337ab7%3B%20text-decoration%3A%20none%3B%22%20href%3D%22https%3A%2F%2Fblogs.technet.microsoft.com%2Fmikelee%2F2017%2F12%2F22%2Fconfigure-tls-encryption-between-sharepoint-on-premise-and-exchange%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3Epost%20%3C%2FA%3Eon%20configuring%20TLS%20between%20SharePoint%20and%20Exchange.%20However%2C%20since%20it%20was%20buried%20in%20process%2C%20I%20wanted%20to%20create%20a%20separate%20post%20just%20sharing%20the%20script%2C%20because%20it%20will%20be%20easier%20to%20maintain%20and%20use%20separately%20when%20needed.%3C%2FP%3E%0A%3CH3%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20inherit%3B%20font-family%3A%20inherit%3B%20font-size%3A%2024px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20normal%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.1%3B%20margin-bottom%3A%2010px%3B%20margin-top%3A%2020px%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20id%3D%22toc-hId--1073368962%22%20id%3D%22toc-hId--1046792444%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20inherit%3B%20font-family%3A%20inherit%3B%20font-size%3A%2024px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20normal%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.1%3B%20margin-bottom%3A%2010px%3B%20margin-top%3A%2020px%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20id%3D%22toc-hId-669441373%22%20id%3D%22toc-hId-696017891%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%22%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20font-weight%3A%20bold%3B%22%3EWhy%20use%20a%20script%20anyway%3F%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH3%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3EI%20find%20this%20script%20very%20useful%20when%20testing%20mail%20flow%20from%20Sharepoint%20since%20it%20uses%20the%20%22SPUtility%3A%3ASendEmail%22%20API%20%2C%20sends%20mail%2C%20captures%20the%20correct%20logs%26nbsp%3Band%20presents%20them%20by%20launching%20notepad%2C%20all%26nbsp%3Bfrom%20a%26nbsp%3Bsingle%20server.%3C%2FP%3E%0A%3CH3%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20inherit%3B%20font-family%3A%20inherit%3B%20font-size%3A%2024px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20normal%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.1%3B%20margin-bottom%3A%2010px%3B%20margin-top%3A%2020px%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20id%3D%22toc-hId--1882715588%22%20id%3D%22toc-hId--1856139070%22%3E%26nbsp%3B%3C%2FH3%3E%0A%3CH3%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20inherit%3B%20font-family%3A%20inherit%3B%20font-size%3A%2024px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20normal%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.1%3B%20margin-bottom%3A%2010px%3B%20margin-top%3A%2020px%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%22%20id%3D%22toc-hId--139905253%22%20id%3D%22toc-hId--113328735%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%22%3E%3CSTRONG%20style%3D%22box-sizing%3A%20border-box%3B%20font-weight%3A%20bold%3B%22%3EThe%20Script%3A%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FH3%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20style%3D%22background-attachment%3A%20scroll%3B%20background-clip%3A%20border-box%3B%20background-color%3A%20white%3B%20background-image%3A%20none%3B%20background-origin%3A%20padding-box%3B%20background-position-x%3A%200%25%3B%20background-position-y%3A%200%25%3B%20background-repeat%3A%20repeat%3B%20background-size%3A%20auto%3B%20border-bottom-left-radius%3A%204px%3B%20border-bottom-right-radius%3A%204px%3B%20border-image-outset%3A%200%3B%20border-image-repeat%3A%20stretch%3B%20border-image-slice%3A%20100%25%3B%20border-image-source%3A%20none%3B%20border-image-width%3A%201%3B%20border-top-left-radius%3A%204px%3B%20border-top-right-radius%3A%204px%3B%20box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20display%3A%20block%3B%20font-family%3A%20Menlo%2CMonaco%2CConsolas%2C%26amp%3Bquot%3B%20courier%20new%26amp%3Bquot%3B%2Cmonospace%3B%20font-size%3A%2013px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20line-height%3A%201.4285%3B%20orphans%3A%202%3B%20overflow%3A%20auto%3B%20overflow-wrap%3A%20break-word%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20pre%3B%20word-break%3A%20break-all%3B%20word-spacing%3A%200px%3B%20padding%3A%209.5px%3B%20margin%3A%200px%200px%2010px%200px%3B%20border%3A%201px%20solid%20%23cccccc%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23%20check%20to%20ensure%20Microsoft.SharePoint.PowerShell%20is%20loaded%20%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24snapin%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%3D%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EGet-PSSnapin%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%7C%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EWhere-Object%3C%2FSPAN%3E%20%7B%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24_%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E.%3C%2FSPAN%3EName%20%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-eq%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E'Microsoft.SharePoint.Powershell'%3C%2FSPAN%3E%7D%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkblue%3B%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24snapin%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-eq%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24null%3C%2FSPAN%3E)%20%7B%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EWrite-Host%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22Loading%20SharePoint%20Powershell%20Snapin%22%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EAdd-PSSnapin%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blueviolet%3B%22%3EMicrosoft.SharePoint.Powershell%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%7D%0A%3C%2FSPAN%3E%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23Parameters%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkblue%3B%22%3EWhile%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24web%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-eq%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24null%3C%2FSPAN%3E)%7B%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24web%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%3D%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EGet-SPWeb%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3ERead-Host%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22Input%20SPWeb%20URL%20using%20http%3A%2F%2F%22%3C%2FSPAN%3E)%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%7D%0A%3C%2FSPAN%3E%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24email%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%3D%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3ERead-Host%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22Input%20E-mail%20recipient%22%3C%2FSPAN%3E)%0A%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24subject%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%3D%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3ERead-Host%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22Input%20E-mail%20Subject%22%3C%2FSPAN%3E)%0A%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24body%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%3D%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3ERead-Host%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22Input%20E-mail%20Body%22%3C%2FSPAN%3E)%0A%3C%2FSPAN%3E%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23specify%20start%20time%20of%20action%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24StartTime%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%3D%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EGet-Date%3C%2FSPAN%3E)%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E.%3C%2FSPAN%3EAddMinutes(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20purple%3B%22%3E-1%3C%2FSPAN%3E)%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E.%3C%2FSPAN%3EToString()%0A%20%3C%2FSPAN%3E%0A%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23%20Try%20sending%20e-mail%20via%20SharePoint.%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24send%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%3D%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%5B%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20teal%3B%22%3EMicrosoft.SharePoint.Utilities.SPUtility%5D%3A%3ASendEmail(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24web%2C%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20purple%3B%22%3E0%2C0%2C%24email%2C%24subject%2C%24body)%0A%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23what%20to%20do%20if%20it%20fails%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkblue%3B%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24send%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-eq%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24false%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-and%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24web%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-ne%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24null%3C%2FSPAN%3E)%7B%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3Ewrite-host%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22It%20didn't%20work%2C%20checking%20ULS%20for%20errors.%20Please%20stand%20by...%22%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-foregroundcolor%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blueviolet%3B%22%3ERed%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-backgroundcolor%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blueviolet%3B%22%3EYellow%3C%2FSPAN%3E%0A%3C%2FSPAN%3E%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23specify%20end%20time%20of%20action%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24EndTime%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%3D%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EGet-Date%3C%2FSPAN%3E)%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E.%3C%2FSPAN%3EAddMinutes(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20purple%3B%22%3E%2B1%3C%2FSPAN%3E)%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E.%3C%2FSPAN%3EToString()%0A%3C%2FSPAN%3E%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23make%20dir%20if%20it%20does%20not%20exist%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24TARGETDIR%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%3D%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22c%3A%5Clogs%22%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkblue%3B%22%3Eif%3C%2FSPAN%3E(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E!%3C%2FSPAN%3E(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3ETest-Path%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-Path%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blueviolet%3B%22%3Ec%3A%5Clogs%3C%2FSPAN%3E))%7B%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3ENew-Item%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-ItemType%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blueviolet%3B%22%3Edirectory%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-Path%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24TARGETDIR%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%7D%0A%3C%2FSPAN%3E%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23finding%20error%20and%20creating%20log%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3Estart-sleep%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20purple%3B%22%3E5%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EGet-SPLogEvent%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-StartTime%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24StartTime%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-EndTime%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24EndTime%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%7C%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EWhere-Object%3C%2FSPAN%3E%20%7B%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24_%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E.%3C%2FSPAN%3ECategory%20%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-eq%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22E-Mail%22%3C%2FSPAN%3E%7D%20%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E%7C%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3EExport-Csv%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-LiteralPath%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22%24TARGETDIR%5Clog.csv%22%0A%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23starting%20notepad%20to%20open%20log%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3Estart%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blueviolet%3B%22%3Enotepad.exe%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24TARGETDIR%5Clog.csv%22%0A%20%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%7D%0A%3C%2FSPAN%3E%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgreen%3B%22%3E%23what%20to%20do%20if%20it%20works%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkblue%3B%22%3Eelse%3C%2FSPAN%3E%7B%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkblue%3B%22%3Eif%3C%2FSPAN%3E%20(%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24send%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-eq%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24true%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-and%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24web%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E-ne%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24null%3C%2FSPAN%3E)%7B%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blue%3B%22%3Ewrite-host%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkred%3B%22%3E%22It%20Worked..Congrats!%22%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-foregroundcolor%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blueviolet%3B%22%3EDarkGreen%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20navy%3B%22%3E-backgroundcolor%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20blueviolet%3B%22%3EWhite%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%7D%0A%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%22%3E%20%7D%3C%2FSPAN%3E%0A%0A%3C%2FSPAN%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20font-family%3A%20Lucida%20Console%3B%20font-size%3A%209pt%3B%22%3E%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20orangered%3B%22%3E%24web%3CSPAN%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20darkgray%3B%22%3E.%3C%2FSPAN%3EDispose()%3C%2FSPAN%3E%0A%20%3C%2FSPAN%3E%0A%3C%2FPRE%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3EExample%3A%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3EAs%20you%20can%20see%20below%20the%20script%20will%20ask%20for%20input%20and%20you%20will%20specify%20the%20SPWeb%20url%2C%20E-Mail%20recipient%2C%20E-Mail%20Subject%20and%20E-Mail%20Body.%20If%20you%20enter%20the%20SP%20Web%20url%20incorrectly%2C%20it%20will%20keep%20asking.%20Also%2C%20if%20the%20e-mail%20is%20not%20sent%2C%26nbsp%3Byou%20will%20be%20notified%20on%20screen%20and%20NOTEPAD%20will%20pop-up%20with%20the%20associated%20ULS%20logs.%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%20style%3D%22box-sizing%3A%20border-box%3B%20color%3A%20%23333333%3B%20font-family%3A%20%26amp%3Bquot%3B%20segoe%20ui%26amp%3Bquot%3B%2Ctahoma%2Carial%2C%26amp%3Bquot%3Bhelvetica%20neue%26amp%3Bquot%3B%2Chelvetica%2Csans-serif%3B%20font-size%3A%2014px%3B%20font-style%3A%20normal%3B%20font-variant%3A%20normal%3B%20font-weight%3A%20400%3B%20letter-spacing%3A%20normal%3B%20orphans%3A%202%3B%20text-align%3A%20left%3B%20text-decoration%3A%20none%3B%20text-indent%3A%200px%3B%20text-transform%3A%20none%3B%20-webkit-text-stroke-width%3A%200px%3B%20white-space%3A%20normal%3B%20word-spacing%3A%200px%3B%20margin%3A%200px%200px%2010px%200px%3B%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20871px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F71543iD6961AE0FDA27E57%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22test-smtp.png%22%20title%3D%22test-smtp.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E

Summary:

 

The following PowerShell script was written for my post on configuring TLS between SharePoint and Exchange. However, since it was buried in process, I wanted to create a separate post just sharing the script, because it will be easier to maintain and use separately when needed.

 

Why use a script anyway?

 

I find this script very useful when testing mail flow from Sharepoint since it uses the "SPUtility::SendEmail" API , sends mail, captures the correct logs and presents them by launching notepad, all from a single server.

 

The Script:

 

# check to ensure Microsoft.SharePoint.PowerShell is loaded 
 $snapin = Get-PSSnapin | Where-Object {$_.Name -eq 'Microsoft.SharePoint.Powershell'}
 if ($snapin -eq $null) {
 Write-Host "Loading SharePoint Powershell Snapin"
 Add-PSSnapin Microsoft.SharePoint.Powershell
 }

#Parameters
 While ($web -eq $null){
 $web = Get-SPWeb (Read-Host "Input SPWeb URL using http://")
 }

$email = (Read-Host "Input E-mail recipient")
$subject = (Read-Host "Input E-mail Subject")
$body = (Read-Host "Input E-mail Body")

#specify start time of action
 $StartTime = (Get-Date).AddMinutes(-1).ToString()
 

# Try sending e-mail via SharePoint.
 $send = [Microsoft.SharePoint.Utilities.SPUtility]::SendEmail($web,0,0,$email,$subject,$body)

#what to do if it fails
 if ($send -eq $false -and $web -ne $null){
 write-host "It didn't work, checking ULS for errors. Please stand by..." -foregroundcolor Red -backgroundcolor Yellow

#specify end time of action
 $EndTime = (Get-Date).AddMinutes(+1).ToString()

#make dir if it does not exist
 $TARGETDIR = "c:\logs"
 if(!(Test-Path -Path c:\logs)){
 New-Item -ItemType directory -Path $TARGETDIR
 }

#finding error and creating log
 start-sleep 5
 Get-SPLogEvent -StartTime $StartTime -EndTime $EndTime | Where-Object {$_.Category -eq "E-Mail"} | Export-Csv -LiteralPath "$TARGETDIR\log.csv"

#starting notepad to open log
 start notepad.exe "$TARGETDIR\log.csv"
 }

#what to do if it works
 else{
 if ($send -eq $true -and $web -ne $null){
 write-host "It Worked..Congrats!" -foregroundcolor DarkGreen -backgroundcolor White
 }
 }

$web.Dispose()
 

 

Example:

 

As you can see below the script will ask for input and you will specify the SPWeb url, E-Mail recipient, E-Mail Subject and E-Mail Body. If you enter the SP Web url incorrectly, it will keep asking. Also, if the e-mail is not sent, you will be notified on screen and NOTEPAD will pop-up with the associated ULS logs.

 

test-smtp.png