I need to send an email report from a script. If I do this from one of our mail relays the email appears as [EXTERNAL]. Since this report includes links, I want users to trust it as coming internally.
I therefore want to use the domain-com.mail.protection.outlook.com
SMTP connector, but when I do this I get Send-MailMessage: The operation has timed out.
This is the send mail line: Send-MailMessage -SmtpServer domain-com.mail.protection.outlook.com -Port 587 -Credential $credential -From my.user@domain.com -To other.user@domain.com -Subject "External Test" -Body Test
The $credential
variable holds the output of Get-Credential
which I logged in with my user account.
I've tried previously to get this to work, but gave up. I have also tried port 25 and Windows Powershell as well as Powershell 7.2.6.
SMTP Authentication is enabled for my user and companywide. I also tried smtp.office365.com as the server.