有没有办法我们可以使用send-mailmessage使用ginormous附件,我尝试了下面的代码片段,它总是超时。请注意,它的测试实验室设置和邮箱相关属性设置为无限制,所以我不会遗漏任何东西来自管理员点。
PS C:\Users\administrator.SMETEST> Send-MailMessage -From "loadtest@smetest.com" -To "loadtestuser4@smetest.com" -SmtpSe
rver HUB -Subject hi -Attachments "C:\officesuite2010sp1-kb2460049-x86-fullfile-en-us.exe" -Verbose
Send-MailMessage : The operation has timed out.
At line:1 char:17
+ Send-MailMessage <<<< -From "loadtest@smetest.com" -To "loadtestuser4@smetest.com" -SmtpServer HUB -Subje
ct hi -Attachments "C:\officesuite2010sp1-kb2460049-x86-fullfile-en-us.exe" -Verbose
+ CategoryInfo : InvalidOperation: (System.Net.Mail.SmtpClient:SmtpClient) [Send-MailMessage], SmtpExcept
ion
+ FullyQualifiedErrorId : SmtpException,Microsoft.PowerShell.Commands.SendMailMessage
尝试下面的方法,它仍然超时
PS C:\Users\administrator.SMETEST> Send-MailMessage -From "loadtest@smetest.com" -To "loadtestuser4@smetest.com" -SmtpSe
rver HUB -Subject hi -Attachments "C:\ADCheck.ps1"
PS C:\Users\administrator.SMETEST> Add-PSSnapin Microsoft.Exchange.Management.Powershell.Admin -erroraction silentlyCont
inue
PS C:\Users\administrator.SMETEST> $file = "C:\officesuite2010sp1-kb2460049-x86-fullfile-en-us.exe"
PS C:\Users\administrator.SMETEST> $smtpServer = "HUB"
PS C:\Users\administrator.SMETEST> $att = new-object Net.Mail.Attachment($file)
PS C:\Users\administrator.SMETEST> $msg = new-object Net.Mail.MailMessage
PS C:\Users\administrator.SMETEST> $smtp = new-object Net.Mail.SmtpClient($smtpServer)
PS C:\Users\administrator.SMETEST> $msg.From = "loadtest@smetest.com"
PS C:\Users\administrator.SMETEST> $msg.To.Add("loadtestuser4@smetest.com")
PS C:\Users\administrator.SMETEST> #$msg.To.Add("administrator2@test.com")
PS C:\Users\administrator.SMETEST> $msg.Subject = "Notification from email server"
PS C:\Users\administrator.SMETEST> $msg.Body = "Attached is the email server mailbox report"
PS C:\Users\administrator.SMETEST> $msg.Attachments.Add($att)
PS C:\Users\administrator.SMETEST> $smtp.Send($msg)
Exception calling "Send" with "1" argument(s): "The operation has timed out."
At line:1 char:11
+ $smtp.Send <<<< ($msg)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodException
PS C:\Users\administrator.SMETEST> $att.Dispose()
PS C:\Users\administrator.SMETEST>