Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update community_snippets.md #1395

Merged
merged 3 commits into from
Jul 2, 2018
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions docs/community_snippets.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ _To contribute, check out our [guide here](#contributing)._
| [PesterTestForParameter](#pestertestforparameter) | _Create Pester test for parameter_ |
| [PSCustomObject](#pscustomobject) | _A simple PSCustomObject by @brettmillerb_ |
| [Region Block](#region-block) | _Region Block for organizing and folding of your code_ |
| [Send-MailMessage](#send-mailmessage) | _Send an mail message with the most common parameters by @fullenw1_ |

## Snippets

Expand Down Expand Up @@ -312,6 +313,35 @@ Use the `#region` for organizing your code (including good code folding).
}
```

### Send-MailMessage

Add the Send-MailMessage cmdlet with the most common parameters in a hashtable for splatting, by @fullenw1.

#### Snippet

```json
"Send-MailMessage": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would recommend naming the snippet something other than the command name. This can get confusing when you think you're autocompleting the command name but then get this snippet. We have been using a naming convention in the extension where "examples" start with ex-. Perhaps you call this snippet ex-send-mail-message?

"prefix": "Send-MailMessage",
"body": [
"$$Params = @{",
" 'SmtpServer' = 'smtp.mycompany.com'",
" 'Port' = 25",
" 'Priority' = 'Normal'",
" 'From' = 'sender@mycompany.com'",
" 'To' = 'mainrecipient@mycompany.com'",
" 'Cc' = 'copyrecipient@mycompany.com'",
" 'Bcc' = 'hiddenrecipient@mycompany.com'",
" 'Subject' = 'Mail title'",
" 'Body' = 'This is the content of my mail'",
" 'BodyAsHtml' = $$false",
" 'Attachments' = 'c:\\MyFile.txt'",
"}",
"Send-MailMessage @Params"
],
"description": "Send a mail message"
}
```

## Contributing

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:
Expand Down