Send email from the command line using SMTP or major service providers.
npm install -g postchi
$ postchi \
--from david@pinkfloyd.com \
--from-name David \
--to roger@pinkfloyd.com \
--to-name Roger \
--subject 'Dark Side of the Moon' \
--text @body.txt \
--html @body.html \
--attachment @time.mp3 \
--image @prism.png \
--smtp-host smtp.example.com \
--smtp-username myusername \
--smtp-password myp@ssw0rd
--from <address>
--from-name <text> (optional)
--to <address>
--to-name <text> (optional)
--cc <address>
--cc-name <text> (optional)
--bcc <address>
--bcc-name <text> (optional)
All of these options can be specified multiple times to send to multiple recipients:
--to roger@pinkfloyd.com --to-name Roger
--to richard@pinkfloyd.com --to-name Richard
--to nick@pinkfloyd.com --to-name Nick
--subject <text>
--text <value>
--html <value>
If you want to read from file, use the following syntax:
--html @body.html
Attachments can be either read from file:
--attachment @message.txt
Or, specified directly:
--attachment 'Hello World'
--attachment-filename 'message.txt'
--attachment-content-type 'text/plain'
Exactly like attachments:
--image @image.png
And you can use them in your email as:
<img src="cid:image.png" />
--transport <smtp|sparkpost|ses> (default: smtp)
--smtp-host <address>
--smtp-port <number> (default: 587)
--smtp-secure <boolean> (default: true)
--smtp-username <text>
--smtp-password <text>
--sparkpost-apikey <text>
--sparkpost-open-tracking <boolean> (default: false)
--sparkpost-click-tracking <boolean> (default: false)
--ses-region <text>
--ses-access-key-id <text>
--ses-secret-access-key <text>
- 1.0
- Initial release.
Soheil Rashidi
Copyright 2019 Soheil Rashidi.
Licensed under the The MIT License (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.opensource.org/licenses/mit-license.php
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.