You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update community_snippets.md
Added the Mail snippet
* Update community_snippets.md
Renamed the snippet
* Update community_snippets.md
Snippet renamed to ex-Send-MailMessage which stands for "example of Send-MailMessage"
|[PesterTestForParameter](#pestertestforparameter)|_Create Pester test for parameter_|
30
30
|[PSCustomObject](#pscustomobject)|_A simple PSCustomObject by @brettmillerb_|
31
31
|[Region Block](#region-block)|_Region Block for organizing and folding of your code_|
32
+
|[Send-MailMessage](#send-mailmessage)|_Send an mail message with the most common parameters by @fullenw1_|
32
33
33
34
## Snippets
34
35
@@ -312,6 +313,35 @@ Use the `#region` for organizing your code (including good code folding).
312
313
}
313
314
```
314
315
316
+
### Send-MailMessage
317
+
318
+
Add the Send-MailMessage cmdlet with the most common parameters in a hashtable for splatting, by @fullenw1.
319
+
320
+
#### Snippet
321
+
322
+
```json
323
+
"ex-Send-MailMessage": {
324
+
"prefix": "ex-Send-MailMessage",
325
+
"body": [
326
+
"$$Params = @{",
327
+
" 'SmtpServer' = 'smtp.mycompany.com'",
328
+
" 'Port' = 25",
329
+
" 'Priority' = 'Normal'",
330
+
" 'From' = 'sender@mycompany.com'",
331
+
" 'To' = 'mainrecipient@mycompany.com'",
332
+
" 'Cc' = 'copyrecipient@mycompany.com'",
333
+
" 'Bcc' = 'hiddenrecipient@mycompany.com'",
334
+
" 'Subject' = 'Mail title'",
335
+
" 'Body' = 'This is the content of my mail'",
336
+
" 'BodyAsHtml' = $$false",
337
+
" 'Attachments' = 'c:\\MyFile.txt'",
338
+
"}",
339
+
"Send-MailMessage @Params"
340
+
],
341
+
"description": "Send a mail message"
342
+
}
343
+
```
344
+
315
345
## Contributing
316
346
317
347
If you'd like to add a snippet to this list, [open a pull request](https://opensource.guide/how-to-contribute/#opening-a-pull-request) with the following changes:
0 commit comments