You are da man..and I will be buying it when its available. Dats fur sure! From: Michael B. Smith [mailto:mich...@theessentialexchange.com] Sent: Thursday, 8 January 2009 2:11 PM To: MS-Exchange Admin Issues Subject: RE: Powershell output to email
I cover this topic, in detail, in my upcoming book: http://snurl.com/45ppf Short answer, pass the string as $Body to this routine: #----- start file ----- #send-mail.ps1 param ([string]$SMTPserver = "192.168.100.10", [string]$SMTPport = "25", [string]$From = "f...@example.com", [string]$To = "t...@example.com", [string]$Subject = "simple subject", [string]$Body = "simple body" ) $var = (new-object net.mail.smtpclient($SMTPserver, $SMTPport)) $var.Send($From, $To, $Subject, $Body) $var = $null #----- end file ----- Regards, Michael B. Smith, MCITP:SA,EMA/MCSE/Exchange MVP My blog: http://TheEssentialExchange.com/blogs/michael I'll be at TEC'2009! http://www.tec2009.com/vegas/index.php From: Greg Mulholland [mailto:g...@krystaltek.com] Sent: Wednesday, January 07, 2009 9:57 PM To: MS-Exchange Admin Issues Subject: Powershell output to email I am writing some exchange housekeeping scripts and would like the output of the script to be emailed to me. I can do this via |out-file and using System.Net.Mail.MailMessage to send the attachment that is generated. But.. what I really would like is the info to be displayed as the body of the email and not as an attachment. If anyone has some code to do that I would appreciate, or knows where I could hunt. Thanks Greg ~ Ninja Email Security with Cloudmark Spam Engine Gets Image Spam ~ ~ http://www.sunbeltsoftware.com/Ninja ~