1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
oauth2token for Debian
----------------------
## Using msmtp for gmail.
I package this software just because gmail force us to use OAuth.
The "app password" doesn't work for me anymore.
First, we must create our own OAuth 2.0 client ID.
https://console.cloud.google.com/apis/credentials
And download the secret file from that page. The file is called
"client_secret_*.json". Please put this file into ~/.config/oauth2token/google
and rename is to "config.json".
Create a file called "~/.config/oauth2token/google/scopes.json". The content
is '["https://mail.google.com/"]'
Now we run "oauth2create google <gmail address>". It will output a link.
Open the link to the browser and authorize it.
Then we can try to run "oauth2get google <gmail address>". You will see the
secret string.
Now we can modify our ~/.msmtprc as following:
#########################################################
account default
host smtp.gmail.com
port 587
from <gmail address>
tls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
auth oauthbearer
user <gmail address>
passwordeval oauth2get google <gmail address>
###########################################################
And then we can start using msmtp.
For example, in ~/.caffrc we can add
$ENV{'PERL_MAILERS'} = 'sendmail:/usr/bin/msmtp';
-- Ying-Chun Liu (PaulLiu) <paulliu@debian.org> Tue, 06 Jun 2023 20:42:14 +0800
|