$Body = "Sample Email Body"
$SmtpServer = 'smtp.gmail.com'
$SmtpUser = 'madhu.hyp2011@gmail.com'
$smtpPassword = 'M@dhu123@#'
$MailtTo = 'madhu.hyp2011@gmail.com'
$MailFrom = 'madhu.hyp2011@gmail.com'
$MailSubject = "Testing Mail Attachments using $SmtpServer"
$Credentials = New-Object System.Management.Automation.PSCredential -ArgumentList $SmtpUser, $($smtpPassword |
ConvertTo-SecureString -AsPlainText -Force)
Send-MailMessage -To "$MailtTo" -from "$MailFrom" -Subject $MailSubject -Body "$Body" -SmtpServer $SmtpServer -BodyAsHtml -UseSsl -Credential $Credentials
write-Output "Custom Message : Attachment Email Sent to Business Users"
No comments:
Post a Comment