1
電子メールを送信しようとしましたが、エラーメッセージが表示されます。私はpowershell 4.0を持っています。私はPrimalFormsで作られたGUIを使用しています。あなたが見ることができるように、私は2つの異なるメールホスティング業者から送信しようとします。 GmailやHotmailのPowershell Send Mailエラーメッセージ
エラーメッセージ:
Send-MailMessage : Die E-Mail-Nachricht kann nicht gesendet werden, da kein SMTP-Server angegeben wurde. Sie müssen entweder mit dem
SmtpServer-Parameter oder der $PSEmailServer-Variablen einen SMTP-Server angeben.
In Zeile:118 Zeichen:9
+ Send-MailMessage -From "$textBox_From.text" -To "$textBox_To. ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Send-MailMessage], InvalidOperationException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.SendMailMessage
-Body : Die Benennung "-Body" wurde nicht als Name eines Cmdlet, einer Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt.
Überprüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang.
In Zeile:119 Zeichen:9
+ -Body "$textBox_Text.text" -SmtpServer "mail.google.com" -por ...
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (-Body:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
私のPowerShellのコード:
$button_MailSenden_OnClick = {
if (($textBox_From.TextLength -eq 0) -or
($textBox_To.TextLength -eq 0) -or
($textBox_Subjekt.TextLength -eq 0) -or
($textBox_Text.TextLength -eq 0)) {
[System.Windows.Forms.MessageBox]::Show("Bitte füllen Sie alle Kriterien aus." , "Combat 19")
#Gmail
} elseif ($radioButton_Gmail.Checked) {
Send-MailMessage -From "$textBox_From.text" -To "$textBox_To.text" -Subject "$textBox_Subjekt.text"
-Body "$textBox_Text.text" -SmtpServer "mail.google.com" -port "587"
[System.Windows.Forms.MessageBox]::Show("Mail gesendet!" , "Combat 19 - Gmail")
#Hotmail
} elseif ($radioButton_Hotmail.Checked) {
Send-MailMessage -From "$textBox_From.text" -To "$textBox_To.text" -Subject "$textBox_Subjekt.text"
-Body "$textBox_Text.text" -SmtpServer "smtp.live.com" -port "487"
[System.Windows.Forms.MessageBox]::Show("Mail gesendet!" , "Combat 19 - Hotmail")
}
}
英語のエラーメッセージを使用してください。 イギリスの旗艦、ドイツの旗、Leute helfen。 – hering
'Send-MailMessage'と' -Body ... 'の間の改行を削除します。 –
これは、-bodyがコマンドレットではないと言います。私はPowerGuiで開くのではなく、smtpサーバに接続していないようです... –