Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Email 尝试向Office 365发送邮件时,Send MailMessage中没有端口参数?_Email_Powershell_Parameters - Fatal编程技术网

Email 尝试向Office 365发送邮件时,Send MailMessage中没有端口参数?

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

以下是我正在使用的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
 -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的下载页是