0
votes

I am using Office 365, Outlook online, and send email with this script:

$Smtp = New-Object Net.Mail.SmtpClient($SmtpServer,$SmtpPort)
$Smtp.EnableSsl = $true
$Smtp.Credentials = New-Object System.Net.NetworkCredential($Username,$Password)
$Smtp.Send($Message)

"$Smtp.Send($Message)", sends email immediately, but I need to schedule sending email, how can I do it ?

1
You can use a scheduled task for this purpose. You might also wanna have a look at docs.microsoft.com/en-us/powershell/module/…Santiago Squarzon
Task Scheduler is the way to go here.Abraham Zinala

1 Answers

0
votes

You can use a schedule task to perform this. Look the New-ScheduleTask command. Note that you might need to execute your command/script with elevated privileges.