Send Email From Office 365 Email Address? RRS feed

  • Question

  • Hello Guys,

    I am using office 365 email address and I am downloading PS script for server health. from last couple of days send mail script is not workout so I need help from forum team. like script error as 

    PS C:\Scripts\ServerHealth1.ps1

    Exception calling "Send" with "1" argument(s): "The SMTP server requires a secure connection or the client was not authenticated.

    The server response was: 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM


    At C:\Scripts\ServerHealth1.ps1:61 char:1

    + $smtp.Send($message)

    + ~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

        + FullyQualifiedErrorId : SmtpException

    guide me for the above script message so I can get mail from O365.


    • Moved by Bill_Stewart Wednesday, May 9, 2018 2:37 PM Unanswerable drive-by question
    Friday, March 16, 2018 1:05 PM

All replies

  • It's pretty clear to see what's going wrong, you need to supply credentials for the FROM address user.

    Also note that we don't rewrite scripts that you found on the internet, ask the author for help.

    Learn PowerShell

    Script Requests

    -Remember to mark the correct response as the answer-

    Friday, March 16, 2018 2:24 PM
  • We cannot help with scripts found on the Internet.  As the author of your script.

    MS has removed support for SSL and TLS 1.0 for O365.  You will need to be sure your system supports TLS 1.2 or better.

    [Net.ServicePointManager]::SecurityProtocol = 'Tls12'


    Friday, March 16, 2018 7:19 PM