The following is an example of how to send an email using PowerShell via O365. If you need to send via Gmail or another provider, it should just be a case of swapping out the SMTP settings.

The email account defined with SMTPClient.Credentials will need a O365 license and will need to have permission to send from the address defined by $EmailFrom. If $EmailFrom is a different mailbox

# O365 Email setup
$SMTPServer = "" 
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587) 
$SMTPClient.EnableSsl = $true 

# Change this sections variables as required 
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("", "Password"); 
$EmailFrom = ""
$EmailTo = ""
$EmailSubject = "Just a Test Mail"
$EmailBody = "<strong>A Test HTML Email</strong>"

# Send the Email
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$EmailSubject,$EmailBody)
$SMTPMessage.IsBodyHTML = $true # Set to $false or delete this line if you want plain text