-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathgSendMail.ps1
More file actions
19 lines (15 loc) · 847 Bytes
/
gSendMail.ps1
File metadata and controls
19 lines (15 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
param($pTo,$pAttachments,$pMsgBody,$pFrom, $pSubject,$pHyperlink)
$smtpServer = "<<gSMTPServer>>"
$msgBody=$pMsgBody + "<BR><a href=""" + $pHyperlink + """>" + $pHyperlink + "</a><BR><BR><small>Sent by JAMS node " + $env:computername + "<BR>Setup <<JAMS.Setup.ParentFolderName>>\<<JAMS.Setup.Name>></small>"
$ToArray=$pTo.split(";") ##split the list of e-mail addresses into an array of string recipients bases on ;
"SMTP Server: " + $smtpserver
"To: " + $ToArray
"From: " + $pFrom
"Subject: " + $pSubject
"Attachments: " + $pAttachments
"Message: "
$msgBody
if ($pAttachments -eq "")
{ Send-MailMessage -To $ToArray -From $pFrom -Subject $pSubject -BodyAsHtml $msgBody -SMTPServer $smtpServer }
Else
{ Send-MailMessage -To $ToArray -From $pFrom -Subject $pSubject -BodyAsHtml $msgBody -SMTPServer $smtpServer -Attachments $pAttachments}