Email 尝试向Office 365发送邮件时,Send MailMessage中没有端口参数?
以下是我正在使用的Powershell版本: $PSVersionTable.PSVersion生成:Email 尝试向Office 365发送邮件时,Send MailMessage中没有端口参数?,email,powershell,parameters,Email,Powershell,Parameters,以下是我正在使用的Powershell版本: $PSVersionTable.PSVersion生成: Major Minor Build Revision ----- ----- ----- -------- 2 0 -1 -1 命令如下: Send-MailMessage -To "someadmin@somedomain.com" -Body "This is just a test" -Subject "Test" -UseSsl -Por
Major Minor Build Revision
----- ----- ----- --------
2 0 -1 -1
命令如下:
Send-MailMessage -To "someadmin@somedomain.com" -Body "This is just a test" -Subject "Test" -UseSsl
-Port 587 -SmtpServer 'smtp.office365.com' -From 'someadmin@somedomain.com' -Credential $creds
以下是错误:
Send-MailMessage : A parameter cannot be found that matches parameter name 'Port'.
At line:1 char:105
+ Send-MailMessage -To "someadmin@somedomain.com" -Body "This is just a test" -Subject "Test" -UseSsl -Port <<<< 587 -S
mtpServer 'smtp.office365.com' -From 'someadmin@somedomain.com' -Credential $creds
+ CategoryInfo : InvalidArgument: (:) [Send-MailMessage], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SendMailMessage
Send MailMessage:找不到与参数名称“Port”匹配的参数。
第1行字符:105
+发送邮件消息-发送至“someadmin@somedomain.com“-Body”这只是一个测试“-Subject”test”-使用SSL-Port是-Port
参数仅可从Powershell 3.0以上版本获得
来源:Windows 7中PowerShell的默认版本不是PowerShell 3.0。(在Windows 8中是Powershell 3。)Powershell 3.0的下载页是