scripting - Not receiving email sent using powershell command -


send-mailmessage -smtpserver "smtp.com.au" -from "me@me.com" -to "you@you.com" -subject "testing" -attachments "\\test\archive.zip" -body "attached" 

i using above command email zip file don't see in (you@you.com) mailbox.

the command runs without errors.

i think problem in function call. miss lot of parameters. take on working gmail example:

$password = convertto-securestring "123456789" -asplaintext -force $emailcredentials = new-object pscredential ("from@gmail.com", $password) try {     send-mailmessage -from "from@gmail.com" -to "to@to.com" -subject "subject" -body "body" -smtpserver "smtp.gmail.com" -port 587 -credential $emailcredentials -encoding utf8 -usessl -erroraction stop } catch {     echo $error[0] } 

there no -credential parameter in call, , i'm sure, that's problem. smtp server may have protocol on different port, -port for. , -usessl, if smtp server encrypting mails, without switch, emails not send. -encoding utf8 regional chars.

check $error[0], may tell you, problem is. check happening on -from email. on gmail can see auto-repiles, error description.

i'm sorry not giving simple solution, don't have enough informations, find it.


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -