In the following article, I have described how to check Site Quota in SharePoint Online Tenant using PowerShell.
Continuing with the Automation series, I am going to describe how to send email notifications after fetching the Quota Report and send them to the concerned team. As we know, sometimes, we need to send a confirmation email by email if the user is not in or working remotely. There is an easy PowerShell cmdlet called ‘Send-MailMessage’ that allows us to send an email to the Exchange Server. We can also use the same function in Office 365.
There are two major options in which we address the Office 365 mail infrastructure.
Here, we are going to use “Authenticated SMTP or TLS session”; in simple words, we are going to use user credentials and an encrypted communication channel.
We need to use a PowerShell script that needs to use the user credentials. Here, we can enter Username and password (using a variable we will store) or we can choose Read line method to ask for the Username and Password manually. Using Password in PowerShell is the easiest way to do it but it is something that is going to breach the security part. Your credentials will be in plain text and can be used by anyone if it is accessible for all users in your domain.
So, we can encrypt the password to avoid security breach using encrypted format. We will need to provide PowerShell the “user password” and the PowerShell command will take this password, encrypt the password, and save it in a text file. In supplementary words, the information is not readable by a human.
Below is the step by step process to “Send a mail PowerShell script” in Office 365.
Set-ExecutionPolicy
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: