Powershell for Sending Attachment and Multiple Recipent

 
Thread Tools Search this Thread
# 1  
Old 05-24-2018
Powershell for Sending Attachment and Multiple Recipent

Hi there,

How could I invoke powershell to:
1. Send a file or an attachment
2. Send a content to multiple recipient
3. Be invoked by a batch file to execute the param clause

Help will be appreciate.


Code:
param(
	[string]$highs, [string]$mediums, [string]$lows 
)

$EmailFrom = “name@domain.com”
$EmailTo = “xxxxx@XXX.com”
$Subject = “New Scan is done!”
$Body = "High=$highs, Mediums=$mediums, Lows=$lows"
$SMTPServer = “smtp.gmail.com”
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
$SMTPClient.EnableSsl = $true
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("Google-UserName", “Google-Password”);
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)


|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Need help sending attachment via mailx mrobin20 UNIX for Beginners Questions & Answers 5 01-27-2016 02:26 PM
Help needed for sending email attachment buzzme Shell Programming and Scripting 7 10-31-2014 06:39 PM
Sending attachment using sendmail command Alok K Yadav Shell Programming and Scripting 1 05-08-2014 02:55 AM
Sending a file as an attachment to email skatpally Shell Programming and Scripting 2 01-10-2013 06:25 PM
Sending mail with attachment sv0081493 UNIX for Advanced & Expert Users 2 10-17-2012 02:39 PM
Problem in Sending mail as an attachment skcvasanth Shell Programming and Scripting 1 06-01-2011 12:25 AM
sending an email with attachment dudd9 Shell Programming and Scripting 4 11-30-2010 09:44 PM
Sending email with attachment and body sridanu UNIX for Dummies Questions & Answers 3 10-29-2010 04:33 AM
Sending Attachment using MIME in UNIX rajesshh Shell Programming and Scripting 9 05-02-2010 09:20 PM
Sending Email with Attachment balajiora Shell Programming and Scripting 3 05-29-2009 05:32 AM
sending an attachment through email Sgiri1 Shell Programming and Scripting 1 04-21-2009 01:46 AM
C code for Sending Email with attachment Mr coder Programming 1 03-06-2009 10:29 AM
Sending attachment to webmail using UNIX supriya5980 UNIX for Dummies Questions & Answers 4 02-04-2009 04:00 AM
sending an attachment - simple question aama100 Shell Programming and Scripting 1 10-27-2008 06:57 AM
Sending attachment thru a mail Rohini Vijay UNIX for Dummies Questions & Answers 1 05-12-2006 02:13 PM