Link to home
Start Free TrialLog in
Avatar of bhieb
bhieb

asked on

Powershell send smtp emaiil to server with CNAME alias

Ok I have a weird scenario. I have a legacy device that takes an SMTP server value, but the field is too short for our o365 domain. It worked fine with the old server name mailtest.ourdomain.com when the exchange server was local. I cannot get the devs to update the field length so I thought I'd try to do it via DNS using a cname alias.  Using a NSLOOKUP on mailtest.ourdomain.com returns the IP for the external o365 address and it lists the alias ourdomain-com.mail.protection.outlook.com.

However to test I fired up powershell and ran this, only to get. "The remote name could not be resolved"

Send-Mailmessage -to "me@ourdomain.com" -from "test@ourdomain.com" -subject "Test" -body "Test"  -smtpserver "mailtest.ourdomain.com"

Open in new window


Running it directly to o365 works.

Send-Mailmessage -to "me@ourdomain.com" -from "test@ourdomain.com" -subject "Test" -body "Test"  -smtpserver "ourdomain-com.mail.protection.outlook.com"

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of bhieb
bhieb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shaun Vermaak
Thank goodness, you had me confused :)