restmail

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

README

restmail

restmail sends email from CLI using gmail & outlook rest APIs. It can be used for email automation, notifications and with git send-mail for sharing patches.

restmail requires only minimal authorization scope to send mail. No access to reading or deleting mail is requested.

Initial Provider Setup (gmail or outlook)

Initial setup is done once / provider. This configures oauth2 clientID & Secret

FROM=your.name@gmail.com
CLIENT_ID=xxxxxx
CLIENT_SECRET=yyyy
restmail -configClient -provider gmail -clientId "${CLIENT_ID}" \ 
   -clientSecret "${CLIENT_SECRET}" -f "${FROM}"

Authorization Setup

Once provider config is set up above, you need to do the oauth flow through a web browser. Setup is only done once or if the tokens are invalidated.

FROM=your.name@gmail.com
restmail -setup -provider gmail -sender "${FROM}"

When this is complete, your auth-token & refresh-token are saved and refreshed automatically.

Sending Messages

FROM=your.name@gmail.com
TO=friend@gmail.com
CC=billy@gmail.com
echo "subject: test subject\n\ntest messagee" | go run . -f "${FROM} -provider gmail "${TO}" cc:"${CC}"

Git send-mail configuration

[sendemail]
        smtpServer = /home/USERNAME/go/bin/restmail
        smtpServerOption = -f=your.name@gmail.com 
        smtpServerOption = -provider 
        smtpServerOption = gmail

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL