Minor changes in Windows scripts
Minor changes in Windows scripts
This commit is contained in:
parent
024fe94ce9
commit
577ad19b9f
@ -1,11 +1,9 @@
|
||||
Function Send-Mail {
|
||||
$EmailFrom = "yourmailadress@somedomain.com"
|
||||
$EmailTo = $args[0]
|
||||
$Subject = $args[1]
|
||||
$Body = $args[0]
|
||||
$SMTPServer = "smtp.somedomain.com"
|
||||
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
|
||||
$SMTPClient.EnableSsl = $true
|
||||
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("usr", "pass");
|
||||
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
|
||||
}
|
||||
$EmailFrom = "yourmailadress@somedomain.com"
|
||||
$EmailTo = $args[0]
|
||||
$Subject = $args[1]
|
||||
$Body = $args[0]
|
||||
$SMTPServer = "smtp.somedomain.com"
|
||||
$SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 587)
|
||||
$SMTPClient.EnableSsl = $true
|
||||
$SMTPClient.Credentials = New-Object System.Net.NetworkCredential("usr", "pass");
|
||||
$SMTPClient.Send($EmailFrom, $EmailTo, $Subject, $Body)
|
||||
|
||||
@ -1,10 +1,10 @@
|
||||
Function Send-Telegram {
|
||||
Param([Parameter(Mandatory=$true)][String]$Message)
|
||||
Param([Parameter(Mandatory=$true)][String]$Message)
|
||||
|
||||
$Telegramtoken = "Your_Telegram_Token"
|
||||
$Telegramchatid = "Your_Telegram_Chat_ID"
|
||||
$Telegramtoken = "Your_Telegram_Token"
|
||||
$Telegramchatid = "Your_Telegram_Chat_ID"
|
||||
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
$Message = $args[0]
|
||||
|
||||
$Response = Invoke-RestMethod -Uri "https://api.telegram.org/bot$($Telegramtoken)/sendMessage?chat_id=$($Telegramchatid)&text=$($Message)"
|
||||
}
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
$Response = Invoke-RestMethod -Uri "https://api.telegram.org/bot$($Telegramtoken)/sendMessage?chat_id=$($Telegramchatid)&text=$($Message)"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user