-
Notifications
You must be signed in to change notification settings - Fork 1
/
Get-RandomLunch.ps1
36 lines (32 loc) · 1.32 KB
/
Get-RandomLunch.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Set-Location $PSScriptRoot
# Examples of some of the parameters available for Get-RandomRestaurant.ps1
$RestaurantParams = @{
Count = 5
SearchOrigin = 'Medborgarplatsen, Stockholm'
APIKey = 'abCdeFghIjkLmnOpqRstUvxYzaB-cdEfgHijKlm'
}
# Store the restaurants for use in email or output to file
$Restaurants = .\Get-RandomRestaurant.ps1 @RestaurantParams
# Examples of the parameters available for Send-LunchEmail.ps1
$MailParameters = @{
SMTPServer = 'smtp.office365.com'
Credential = Get-Credential
Port = 587
UseSsl = $true
To = 'test@example.com'
From = 'test@example.com'
Text = "Vote for today's lunch restaurant!"
Subject = 'Lunch time!'
Restaurants = $Restaurants
PollText = "Vote here!"
PollTitle = 'May the best restaurant win!'
StrawPoll = $true
# Most of the text parameters have "support" for HTML
PostText = @"
This mail was generated in the middle of Stockholm, Sweden.
<br><br>
Your address {mail} has been registered to receive these emails, if you would like to unsubscribe you need to talk to the lunch administrator.
"@
}
.\Send-LunchEmail.ps1 @MailParameters
#.\Save-LunchToFile.ps1 -Text $MailParameters.Text -PostText $MailParameters.PostText -Restaurants $Restaurants -Poll -PollText $MailParameters.PollText -PollTitle $MailParameters.PollTitle