Send-Mailmessage vs Telnet and Non-Accepted Domains

Copper Contributor

Hello Community,

 

i noticed, that if i try to send an email via telnet to an external domain the session gives me the error "SMTP; Unable to relay recipient in non-accepted domain" - thats good and how you would expect it.

 

But if i do the same test now with the Powershellcommand Send-Mailmessage the mail is being send to the external recipient.

 

Can someone explain to my why that works? Where is the difference between the telnet sesssion and the powershell session?

 

[EDIT]
In Telnet i use the commands:
telnet exchange2016fqdn 25
ehlo
mail from:user@internaldomain

rcpt to:user@externaldomain

SMTP; Unable to relay recipient in non-accepted domain

 

The powershellcommand looks like this:

Send-MailMessage -to "user@externaldomain" -from "user@internaldomain" -Subject "Test" -body "Test Send-MailMessage" -smtpserver  exchange2016fqdn

 

With kind regards

Malik Thien

1 Reply
I think i found the answer.

If someone is curious; the powershell is running withing the user context hence using the cerberos token. You can see the sessionauthentication via these commands
$token = [System.Security.Principal.WindowsIdentity]::GetCurrent()
$token

My test-mail was received on the exchange "client proxy"-Receive Connector. In the Security context of that connector Windows Authentication is active so that makes sense i guess.