0
我想在使用Windows 8和powersell的一行中从我的gmail ccoiunt发送一封电子邮件。这是我使用的代码:使用凭据从powershell命令行发送电子邮件
Send-MailMessage -smtpServer 'smtp.gmail.com' -port 587 -from '[email protected]' -to '[email protected]' -subject 'Test' -body 'Body' –UseSsl
但我不知道如何添加凭据。我怎样才能将用户名和密码添加到这个单一的代码行? (不需要加密密码)。
感谢
的可能重复[如何凭据传递到发送,命令MAILMESSAGE用于发送电子邮件(http://stackoverflow.com/questions/12460950/how-to-pass -createntials-to-the-send-mailmessage-command-for-sending-emails) –
它不是重复的,因为“-credential $ mycredentials”在单一代码行中没有证书。我不知道如何将用户名和密码添加到该“-credential”命令 – Ton
尝试阅读答案,而不仅仅是问题。 –