How To Send SMTP Mail Using PowerShell And Office 365

Поделиться
HTML-код
  • Опубликовано: 20 авг 2024
  • In this tutorial, we will create a windows PowerShell script that can send smtp mail using office365 as SMTP Server.

Комментарии • 21

  • @copycat02uk
    @copycat02uk Год назад

    Thanks mate, hours searching and failing and your video resolved it on the 1st go 🤗

    • @prajnasaha1334
      @prajnasaha1334 Год назад

      Hi , which email did you use , outlook , gmail or any other?

  • @samsuthenakbarali1115
    @samsuthenakbarali1115 Год назад +1

    Thank you for the video, its was very useful.. can you please let me know how to attach .pdf file

  • @pythonblac130
    @pythonblac130 Год назад +1

    Good Vid Bernard, saved me a lot of trouble from trying to use MS Graph, a few pointers though, for unattended scripts, better to use the Microsoft Secret module, so for your credential you just pass " $creds = Get-Credential (Get-Secret -Vault MySecretVault -Name MySecretKey)",, Is there a reason you didn't just run the code from within VSCode but rather decided to copy and paste it in Powershell?

  • @Aayush588
    @Aayush588 3 месяца назад

    How to add sensitivity label ?

  • @varathasiva
    @varathasiva Год назад

    Thanks a lot I can send email using this, how we can add attachment and please let us know.

  • @sadishdash1121
    @sadishdash1121 Год назад

    Really helped alot man. Ty

  • @karanjadavid2178
    @karanjadavid2178 Год назад

    Thank you for this.

  • @gauravkumarsingh837
    @gauravkumarsingh837 Год назад

    Very very thank you.!

  • @alejandramora7489
    @alejandramora7489 Год назад +1

    Thank you for your video.
    I got an error: "send-MailMessage: The SMTP server requires a secure connection or the client was not authenticated. The server response was; 5.7.57 client was not authenticated to send mail. Error 535 5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully." Do you know what can I do about it? (I'm using my employer account).
    Thanks a lot

    • @duncanwaeterinckx6207
      @duncanwaeterinckx6207 Год назад

      Same issue here, does anyone have a tip ? SMTP Auth already set on o365 for this account

    • @karanjadavid2178
      @karanjadavid2178 Год назад

      I got this when trying to send from a gmail account. I think google has strict security restrictions recently. Switched to an outlook account and the script ran error free.

    • @AshokYadav-is7wx
      @AshokYadav-is7wx Год назад

      @@karanjadavid2178 You have to do fowlling things
      1.go to gmail -->Setting-->Accounts and Imports tab -->Other google account setting --->Security Section
      2.trun on 2 Step verification
      3.create an APP Password
      4.Copy that APP Password
      5.Pate into the $pwd_1=" Your App Password " then just run the script you will able to send mails

    • @AshokYadav-is7wx
      @AshokYadav-is7wx Год назад

      If works Please message me back

    • @Himricks
      @Himricks Год назад

      Did anyone got the solution for this ?

  • @ashleytaylor8000
    @ashleytaylor8000 Год назад +1

    Will this method still work with the deprecation of SMTP AUTH on 1st October??

    • @varathasiva
      @varathasiva Год назад

      I tried today 27th October 2022, can send email using above video tutorial

  • @mindenesvegyes8512
    @mindenesvegyes8512 Год назад

    oauth v2.... not this old and insecure way

  • @jsanmarb
    @jsanmarb Год назад

    Send-MailMessage : A positional parameter cannot be found that accepts argument 'r'.
    At line:1 char:1
    + Send-MailMessage @props @body
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidArgument: (:) [Send-MailMessage], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SendMailMessage