Quantcast
Channel: PowerShell General
Viewing all articles
Browse latest Browse all 10624

Send-MailMessage Issue

$
0
0

Hi,

I want to use Send-MailMessage in my script to send emails.

When I test the command I am getting this error.

Command : Send-MailMessage -From user1@xxxx.comuser1@xxxx.com -Subject "Tesdt" -Body "test test "

Error :

Send-MailMessage : Mailbox unavailable. The server response was: 5.7.1 Client does not have permissions to send as this sender

But If i execute it like this it works.

Command : Send-MailMessage -From user1@xxxx.com-To user1@xxxx.com -Subject "Tesdt" -Body "test test " -Credential Get-Credential

then it will ask open the Credential dialog box i dont do anything just hit enter it actaully works :P

Can somebody please explain whey is it working with false credentials ? and how can i make it work properly? maybe i need to supply anonemous crediantials or something ? or empty credentials ? 

Thank You 

 

 


Viewing all articles
Browse latest Browse all 10624

Trending Articles