Powershell for Sending Attachment and Multiple Recipent

Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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)

Login or Register to Reply

|
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
Hello, I am new to the Unix thing, and I am having trouble sending attachments via shell client putty through mailx. The command I use is $ mailx -s "Subject" user@blah.com < attachment.txt but everytime I do that it would say Cannot open attachment.txt I have the file save to my computer...... UNIX for Beginners Questions & Answers
5
UNIX for Beginners Questions & Answers
sending an email with attachment
dudd9
Hi, Please help me in sending an e-mail with attachment through unix mailx command is not present in our unix box.... Shell Programming and Scripting
4
Shell Programming and Scripting
Sending Email with Attachment
balajiora
Hi, I want to send an email with multiple attachment using uuencode and mail command. I am able to send with one attachment Ex:uuencode abc.txt abc.txt | mail test@test.com -s "Test3" Can anyone reply with syntax. Regards BS... Shell Programming and Scripting
3
Shell Programming and Scripting
sending an attachment through email
Sgiri1
As a part of requirement I need to send out mails with attachment from UNIX. I have to take query the Oracle DB and send the result of the query in an attachment through mail. I use the following script for the same. #!/bin/csh #!/bin/bash #!/bin/ksh ATTFILE=/folder1/test.xls cd...... Shell Programming and Scripting
1
Shell Programming and Scripting
Sending attachment thru a mail
Rohini Vijay
Is there any way we can send file attachemnts through mails from a unix server. Does the 'mail' command have such an option ??... UNIX for Dummies Questions & Answers
1
UNIX for Dummies Questions & Answers