Nechce se mi to vymýšlet vždy znovu a znovu, tak šup sem s tím.
$creds = get-credential
$sender = "user@domain.tld"
$recipient = "recipient@domain.tld"
$server = "server.domain.tld"
Send-MailMessage -From $sender -To $recipient -Subject "Test Email" -Body "Test SMTP Service from Powershell on Port 587" -SmtpServer $server -Credential $creds -UseSsl -Port 587