Posts

Showing posts from October, 2019

Powershell send e mail

Powershell send e mail: $From = "pugazh@pugazh.in" $To = "pugazh@pugazh.in" $Subject = "Here's the Email Subject" $Body = "This is what I want to say" $SMTPServer = "smtp.hostinger.in" $SMTPPort = "587" Send-MailMessage -From $From -to $To -Subject $Subject -Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl -Credential (Get-Credential) –DeliveryNotificationOption OnSuccess

Powershell to check the public IP and trigger the mail

$IPstatus = Invoke-WebRequest -Uri "https://whatismyipaddress.com/ip/4.4.4.8" -Headers @{"Referer"="https://www.google.com/"; "User-Agent"="Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"} If ($IPstatus.StatusDescription -eq 'ok') {send-mailmessage -smtpserver smtp.office365.com -to pugazh@pugazh.co.in -from report@pugazh.co.in -subject 'MPLS Link is UP now' -Port 25} Refer: Link