powershell send email
2011-01-12 17:31
232 查看
#mail server configuration
$smtpServer = ""
$smtpUser = ""
$smtpPassword = ""
#create the mail message
$mail = New-Object System.Net.Mail.MailMessage
#set the addresses
$MailAddress=""
$MailtoAddress=""
$mail.From = New-Object System.Net.Mail.MailAddress($MailAddress)
$mail.To.Add($MailtoAddress)
#set the content
$mail.Subject = ""
$mail.Priority = ""
$mail.Body = ""
$filename="file"
$attachment = new-Object System.Net.Mail.Attachment($filename)
$mail.Attachments.Add($attachment)
#send the message
$smtp = New-Object System.Net.Mail.SmtpClient -argumentList $smtpServer
$smtp.Credentials = New-Object System.Net.NetworkCredential -argumentList $smtpUser,$smtpPassword
$smtp.Send($mail)
$smtpServer = ""
$smtpUser = ""
$smtpPassword = ""
#create the mail message
$mail = New-Object System.Net.Mail.MailMessage
#set the addresses
$MailAddress=""
$MailtoAddress=""
$mail.From = New-Object System.Net.Mail.MailAddress($MailAddress)
$mail.To.Add($MailtoAddress)
#set the content
$mail.Subject = ""
$mail.Priority = ""
$mail.Body = ""
$filename="file"
$attachment = new-Object System.Net.Mail.Attachment($filename)
$mail.Attachments.Add($attachment)
#send the message
$smtp = New-Object System.Net.Mail.SmtpClient -argumentList $smtpServer
$smtp.Credentials = New-Object System.Net.NetworkCredential -argumentList $smtpUser,$smtpPassword
$smtp.Send($mail)
相关文章推荐
- PowerShell中两种发邮件方法Send-EasyEmail和Send-MailMessage的用法
- Send email alert from Performance Monitor using PowerShell script (检测windows服务器的cpu 硬盘 服务等性能,发email的方法) -摘自网络
- PowerShell中两种发邮件方法Send-EasyEmail和Send-MailMessage的用法
- powershell send email
- Using exchange server to send email in Powershell
- Java Send email
- How do I authenticate to send an email
- sendEmail问题总结
- cakephp send email via html format
- Save an XML File to Database and Send an Email using XSLT
- zabbix使用sendEmail实现邮件报警
- zabbix使用sendEmail实现邮件报警
- sendEmail实现邮件报警
- mailx及sendEmail的基本用法比较
- nagios使用sendEmail发送邮件
- IBM eCommerce中Send Email的不同方式
- nagios与sendEmail结合实现邮件报警
- zabbix利用sendEmail邮件报警
- asp.net 错误提示:Could not load type 'SendEmail.WebPage'
- 如何使用sendEmail发送邮件