$user = $args[0] $CPU = $args[1] $computer = $args[2] $date= (Get-Date).ToString('dd.MM.yyyy-HH:mm:ss') $From = "Sivy.Crow@gmail.com" $To = "Sivy.Crow@gmail.com" $Subject = "test" $Body = @" "primary affected service":"CI00002920", "potential problem ci": "=$computer", "contact": "DKX1FGR8H0", "service recipient": "DKX1FGR8H0", "subcategory": "PLATFORM", "area": "infrastructure", "title": ["Server =$computer has reached 65% RAM threshold on $date"], "description": ["$computer, has a high memory usage."], "impact": 3, "urgency": 3, "assignment": "ASG00150" "company": "DEVWFS" "@ ##$Cc = "YourBoss@YourDomain.com" $emailPassword = "YourPassword" $username = "Sivan.Kroitoru@gmail.com" $secpasswd = ConvertTo-SecureString $emailPassword -AsPlainText -Force $mycreds = New-Object System.Management.Automation.PSCredential ($username, $secpasswd) $Subject = "ControlUp CPU utilization alert $computer" $SMTPServer = "YourSMTPServerName" $SMTPPort = "YourPort" Send-MailMessage -From $From -to $To -SmtpServer $SMTPServer -port $SMTPPort -Credential $mycreds -Subject $Subject -Body $Body