Sending email via Office 365 from Power Shell

%3CLINGO-SUB%20id%3D%22lingo-sub-2279301%22%20slang%3D%22en-US%22%3ESending%20email%20via%20Office%20365%20from%20Power%20Shell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2279301%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%20we've%20just%20migrated%20to%20the%20Azure%20%26amp%3B%20Office%20365%2FExchange%20Online.%20Now%20we%20need%20to%20reconfigure%20some%20of%20our%20PowerShell%20monitoring%20scripts%20to%20send%20emails%20via%20the%20Exchange%20Online.%20Previously%20we%20used%20Exchange%20On-Premise%20for%20such%20purpose.%20I've%20reconfigure%20the%20PowerShell%20scripts%20from%20%22mail.localdomain.com%3A25%22%20to%20the%20%22smtp.office365.com%3A587%22%20but%20when%20I%20ran%20the%20script%20I've%20recived%20the%20error%20that%20there%20is%20no%20TLS%20(STARTTLS)%20in%20place%20and%20an%20email%20within%20our%20domain%20cannot%20be%20send.%20Could%20you%20tell%20me%20how%20to%20use%20PowerShell%20script%20to%20send%20an%20emails%20within%20our%20domain%20from%20it%20bu%20using%20the%20Exchange%20Online%20server%20%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2279301%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2293013%22%20slang%3D%22en-US%22%3ERe%3A%20Sending%20email%20via%20Office%20365%20from%20Power%20Shell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2293013%22%20slang%3D%22en-US%22%3E%3CP%3EThanks%20%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F91349%22%20target%3D%22_blank%22%3E%40Patrick%20Wahlm%C3%BCller%3C%2FA%3E%26nbsp%3B%2C%20I'll%20test%20it.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2279721%22%20slang%3D%22en-US%22%3ERe%3A%20Sending%20email%20via%20Office%20365%20from%20Power%20Shell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2279721%22%20slang%3D%22en-US%22%3EThis%20might%20help%3A%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FArchitektApx%2FSend-O365EWSMailMessage%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgithub.com%2FArchitektApx%2FSend-O365EWSMailMessage%3C%2FA%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi, we've just migrated to the Azure & Office 365/Exchange Online. Now we need to reconfigure some of our PowerShell monitoring scripts to send emails via the Exchange Online. Previously we used Exchange On-Premise for such purpose. I've reconfigure the PowerShell scripts from "mail.localdomain.com:25" to the "smtp.office365.com:587" but when I ran the script I've recived the error that there is no TLS (STARTTLS) in place and an email within our domain cannot be send. Could you tell me how to use PowerShell script to send an emails within our domain from it bu using the Exchange Online server ?

2 Replies

Thanks @Patrick Wahlmüller , I'll test it.