Skip to content

Commit

Permalink
Update community_snippets.md (#1395)
Browse files Browse the repository at this point in the history
* 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"
  • Loading branch information
fullenw1 authored and TylerLeonhardt committed Jul 2, 2018
1 parent 705f174 commit f54a611
Showing 1 changed file with 30 additions and 0 deletions.
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
"ex-Send-MailMessage": {
"prefix": "ex-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

0 comments on commit f54a611

Please sign in to comment.