Skip to content

Commit ae0b60e

Browse files
committed
Merge branch 'ag/doc-send-email'
The `send-email` documentation has been updated with OAuth2.0 related examples. * ag/doc-send-email: docs: add credential helper for outlook and gmail in OAuth list of helpers docs: improve send-email documentation send-mail: improve checks for valid_fqdn
2 parents 4bb7254 + ba998f6 commit ae0b60e

File tree

3 files changed

+66
-9
lines changed

3 files changed

+66
-9
lines changed

Documentation/git-send-email.adoc

Lines changed: 59 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -509,12 +509,12 @@ include::includes/cmd-config-section-all.adoc[]
509509

510510
include::config/sendemail.adoc[]
511511

512-
EXAMPLES
513-
--------
514-
Use gmail as the smtp server
512+
EXAMPLES OF SMTP SERVERS
513+
------------------------
514+
Use Gmail as the SMTP Server
515515
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
516-
To use 'git send-email' to send your patches through the GMail SMTP server,
517-
edit ~/.gitconfig to specify your account settings:
516+
To use `git send-email` to send your patches through the Gmail SMTP server,
517+
edit `~/.gitconfig` to specify your account settings:
518518

519519
----
520520
[sendemail]
@@ -528,6 +528,41 @@ If you have multi-factor authentication set up on your Gmail account, you can
528528
generate an app-specific password for use with 'git send-email'. Visit
529529
https://security.google.com/settings/security/apppasswords to create it.
530530

531+
You can also use OAuth2.0 authentication with Gmail. `OAUTHBEARER` and
532+
`XOAUTH2` are common methods used for this type of authentication. Gmail
533+
supports both of them. As an example, if you want to use `OAUTHBEARER`, edit
534+
your `~/.gitconfig` file and add `smtpAuth = OAUTHBEARER` to your account
535+
settings:
536+
537+
----
538+
[sendemail]
539+
smtpEncryption = tls
540+
smtpServer = smtp.gmail.com
541+
smtpUser = [email protected]
542+
smtpServerPort = 587
543+
smtpAuth = OAUTHBEARER
544+
----
545+
546+
Use Microsoft Outlook as the SMTP Server
547+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
548+
Unlike Gmail, Microsoft Outlook no longer supports app-specific passwords.
549+
Therefore, OAuth2.0 authentication must be used for Outlook. Also, it only
550+
supports `XOAUTH2` authentication method.
551+
552+
Edit `~/.gitconfig` to specify your account settings for Outlook and use its
553+
SMTP server with `git send-email`:
554+
555+
----
556+
[sendemail]
557+
smtpEncryption = tls
558+
smtpServer = smtp.office365.com
559+
smtpUser = [email protected]
560+
smtpServerPort = 587
561+
smtpAuth = XOAUTH2
562+
----
563+
564+
SENDING PATCHES
565+
---------------
531566
Once your commits are ready to be sent to the mailing list, run the
532567
following commands:
533568

@@ -536,9 +571,25 @@ following commands:
536571
$ git send-email outgoing/*
537572

538573
The first time you run it, you will be prompted for your credentials. Enter the
539-
app-specific or your regular password as appropriate. If you have credential
540-
helper configured (see linkgit:git-credential[1]), the password will be saved in
541-
the credential store so you won't have to type it the next time.
574+
app-specific or your regular password as appropriate.
575+
576+
If you have a credential helper configured (see linkgit:git-credential[1]), the
577+
password will be saved in the credential store so you won't have to type it the
578+
next time.
579+
580+
If you are using OAuth2.0 authentication, you need to use an access token in
581+
place of a password when prompted. Various OAuth2.0 token generators are
582+
available online. Community maintained credential helpers for Gmail and Outlook
583+
are also available:
584+
585+
- https://github.com/AdityaGarg8/git-credential-email[git-credential-gmail]
586+
(cross platform, dedicated helper for authenticating Gmail accounts)
587+
588+
- https://github.com/AdityaGarg8/git-credential-email[git-credential-outlook]
589+
(cross platform, dedicated helper for authenticating Microsoft Outlook accounts)
590+
591+
You can also see linkgit:gitcredentials[7] for more OAuth based authentication
592+
helpers.
542593

543594
Note: the following core Perl modules that may be installed with your
544595
distribution of Perl are required:

Documentation/gitcredentials.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ Popular helpers with OAuth support include:
133133

134134
- https://github.com/hickford/git-credential-oauth[git-credential-oauth] (cross platform, included in many Linux distributions)
135135

136+
- https://github.com/AdityaGarg8/git-credential-email[git-credential-gmail] (cross platform, dedicated helper to authenticate Gmail accounts for linkgit:git-send-email[1])
137+
138+
- https://github.com/AdityaGarg8/git-credential-email[git-credential-outlook] (cross platform, dedicated helper to authenticate Microsoft Outlook accounts for linkgit:git-send-email[1])
139+
136140
CREDENTIAL CONTEXTS
137141
-------------------
138142

git-send-email.perl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,9 @@ sub process_address_list {
13591359

13601360
sub valid_fqdn {
13611361
my $domain = shift;
1362-
return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/) && $domain =~ /\./;
1362+
my $subdomain = '(?!-)[A-Za-z0-9-]{1,63}(?<!-)';
1363+
return defined $domain && !($^O eq 'darwin' && $domain =~ /\.local$/)
1364+
&& $domain =~ /^$subdomain(?:\.$subdomain)*$/;
13631365
}
13641366

13651367
sub maildomain_net {

0 commit comments

Comments
 (0)