Send-Message `
-From $emailAuthUser `
-To $($emailTo -split ',') `
if($emailCC -ne "NA") { -CC $($emailCC -split ',') } `
-Subject $emailSubject `
-Body $emailBody `
-Attachments $attachments `
-ReplyTo $($emailReplyTo -split ',') `
-SmtpServer $emailSmtpServer `
-Port $emailSmtpPort `
-Credential $creds `
-UseSsl
Error: A positional parameter cannot be found that accepts argument 'if'.
Is there an easy way to optionally include a parameter in a "built-in" cmdlet like I am trying to accomplish above? If so, how?