Send-SmtpMail and writing a success message

Topics: Developer Forum
Jan 1, 2007 at 3:15 AM
Give the Send-SmtpMail cmdlet a try. I'm in a quandary over whether this cmdlet should spit out the MailMessage to pipeline by default as an indication of success. Or if I should just do the equivalent of a Write-Host "Message sent."? I could also choose to output the MailMessage only if -PassThru is specified. The thing I don't like about using Write-Host is that if you are scripting and want to capture the output of each command, then anything sent to the host doesn't get captured.
Jan 1, 2007 at 8:26 PM
i think the command should write-verbose 'Message sent' and output the MailMessage when passtrhru switch is present. otherwise, it should be silent
Jan 2, 2007 at 3:37 AM
OK, I've changed the cmdlet to behave this way.