I have various PowerShell scripts on Windows Server 2012 R2 that I like to notify me via email upon completion, so I setup a local SMTP server that is restricted to 127.0.0.1 only, and use this command:
Send-MailMessage -To "myemail@gmail.com" -From "myemail@gmail.com" -SMTPServer localhost -Subject "Script 1" -Body "Script 1 has finished"
But the problem is GMail and other services says "Beware" or put it in SPAM. Is there any From email or something I can quickly/easily do to get it to hit my inbox without issue?
Edit: This is from a Microsoft Demo VM with Contoso.com domain.
Edit 2: The domain "contoso.com" is a fictional domain that I can't setup an SPF record for.
Can I somehow set the reply from the server's actual IP address so that email servers consider it "genuine"?