Why is SMTP Relay necessary

DonDon Member Posts: 1
Hi,

sending an email from the service tier server using following code (via powershell) works fine:
$EmailTo = "<email>"
$EmailFrom = "<from>"
$Subject = "Test"
$Body = "Test Body"
$SMTPServer = "<smtpserver>" // is an exchange server
$SMTPMessage = New-Object System.Net.Mail.MailMessage($EmailFrom,$EmailTo,$Subject,$Body)
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("<user>", "<password>");
$SMTPClient.Send($SMTPMessage)

smtp server hosted inhouse . emailto is an mail adresse outside the domain.
when im sending mail via cu 400 (same server, same settings: port, etc.) i get following error message:
bla bla ... *5.7.54 SMPT; unable to relay recipient in non-accepted domain".

so i searched with google: i understand that you could use an relay setting on exchange server
but our it says: they dont set up relay settings on their exchange server.

My Question: Why is it possible to send this mail via powershell with same settings on same server as i tried with cu400, where it faild?

thx, regards

Answers

Sign In or Register to comment.