NAME
git-send-email - Send a collection of patches as emails
SYNOPSIS
- git send-email [<options>] <file|directory|rev-list options>…
- git send-email --dump-aliases
DESCRIPTION
Takes the patches given on the command line and emails them out.Patches can be specified as files, directories (which will send allfiles in the directory), or directly as a revision list. In thelast case, any format accepted by git-format-patch[1] canbe passed to git send-email.
The header of the email is configurable via command-line options. If notspecified on the command line, the user will be prompted with a ReadLineenabled interface to provide the necessary information.
There are two formats accepted for patch files:
- mbox format files
This is what git-format-patch[1] generates. Most headers and MIMEformatting are ignored.
- The original format used by Greg Kroah-Hartman’s _send_lots_of_email.pl_script
This format expects the first line of the file to contain the "Cc:" valueand the "Subject:" of the message as the second line.
OPTIONS
Composing
- —annotate
Review and edit each patch you’re about to send. Default is the valueof
sendemail.annotate
. See the CONFIGURATION section forsendemail.multiEdit
.- ,…
- Specify a "Bcc:" value for each email. Default is the value of
sendemail.bcc
.
This option may be specified multiple times.
This option may be specified multiple times.
- —compose
- Invoke a text editor (see GIT_EDITOR in git-var[1])to edit an introductory message for the patch series.
When —compose
is used, git send-email will use the From, Subject, andIn-Reply-To headers specified in the message. If the body of the message(what you type after the headers and a blank line) only contains blank(or Git: prefixed) lines, the summary won’t be sent, but From, Subject,and In-Reply-To headers will be used unless they are removed.
Missing From or In-Reply-To headers will be prompted for.
See the CONFIGURATION section for sendemail.multiEdit
.
- —from=
Specify the sender of the emails. If not specified on the command line,the value of the
sendemail.from
configuration option is used. Ifneither the command-line option norsendemail.from
are set, then theuser will be prompted for the value. The default for the prompt will bethe value of GIT_AUTHOR_IDENT, or GIT_COMMITTER_IDENT if that is notset, as returned by "git var -l".Specify the address where replies from recipients should go to.Use this if replies to messages should go to another address than whatis specified with the —from parameter.
- Make the first mail (or all the mails with
—no-thread
) appear as areply to the given Message-Id, which avoids breaking threads toprovide a new patch series.The second and subsequent emails will be sent as replies according tothe—[no-]chain-reply-to
setting.
So for example when —thread
and —no-chain-reply-to
are specified, thesecond and subsequent patches will be replies to the first one like in theillustration below where [PATCH v2 0/3]
is in reply to [PATCH 0/2]
:
- [PATCH 0/2] Here is what I did...
- [PATCH 1/2] Clean up and tests
- [PATCH 2/2] Implementation
- [PATCH v2 0/3] Here is a reroll
- [PATCH v2 1/3] Clean up
- [PATCH v2 2/3] New tests
- [PATCH v2 3/3] Implementation
Only necessary if —compose is also set. If —composeis not set, this will be prompted for.
- —subject=
Specify the initial subject of the email thread.Only necessary if —compose is also set. If —composeis not set, this will be prompted for.
- ,…
- Specify the primary recipient of the emails generated. Generally, thiswill be the upstream maintainer of the project involved. Default is thevalue of the
sendemail.to
configuration value; if that is unspecified,and —to-cmd is not specified, this will be prompted for.
This option may be specified multiple times.
- —8bit-encoding=
- When encountering a non-ASCII message or subject that does notdeclare its encoding, add headers/quoting to indicate it isencoded in
. Default is the value of thesendemail.assume8bitEncoding; if that is unspecified, thiswill be prompted for if any non-ASCII files are encountered.
Note that no attempts whatsoever are made to validate the encoding.
- —compose-encoding=
Specify encoding of compose message. Default is the value of thesendemail.composeencoding; if that is unspecified, UTF-8 is assumed.
- Specify the transfer encoding to be used to send the message over SMTP.7bit will fail upon encountering a non-ASCII message. quoted-printablecan be useful when the repository contains files that contain carriagereturns, but makes the raw patch email file (as saved from a MUA) muchharder to inspect manually. base64 is even more fool proof, but alsoeven more opaque. auto will use 8bit when possible, and quoted-printableotherwise.
Default is the value of the sendemail.transferEncoding
configurationvalue; if that is unspecified, default to auto
.
- —xmailer
- —no-xmailer
- Add (or prevent adding) the "X-Mailer:" header. By default,the header is added, but it can be turned off by setting the
sendemail.xmailer
configuration variable tofalse
.
Sending
- —envelope-sender=
Specify the envelope sender used to send the emails.This is useful if your default address is not the address that issubscribed to a list. In order to use the From address, set thevalue to "auto". If you use the sendmail binary, you must havesuitable privileges for the -f parameter. Default is the value of the
sendemail.envelopeSender
configuration variable; if that isunspecified, choosing the envelope sender is left to your MTA.Specify the encryption to use, either ssl or tls. Any othervalue reverts to plain SMTP. Default is the value of
sendemail.smtpEncryption
.Specifies the Fully Qualified Domain Name (FQDN) used in theHELO/EHLO command to the SMTP server. Some servers require theFQDN to match your IP address. If not set, git send-email attemptsto determine your FQDN automatically. Default is the value of
sendemail.smtpDomain
.- Whitespace-separated list of allowed SMTP-AUTH mechanisms. This settingforces using only the listed mechanisms. Example:
- $ git send-email --smtp-auth="PLAIN LOGIN GSSAPI" ...
If at least one of the specified mechanisms matches the ones advertised by theSMTP server and if it is supported by the utilized SASL library, the mechanismis used for authentication. If neither sendemail.smtpAuth nor —smtp-auth
is specified, all mechanisms supported by the SASL library can be used. Thespecial value none maybe specified to completely disable authenticationindependently of —smtp-user
- —smtp-pass[=
] - Password for SMTP-AUTH. The argument is optional: If noargument is specified, then the empty string is used asthe password. Default is the value of
sendemail.smtpPass
,however—smtp-pass
always overrides this value.
Furthermore, passwords need not be specified in configuration filesor on the command line. If a username has been specified (with—smtp-user
or a sendemail.smtpUser
), but no password has beenspecified (with —smtp-pass
or sendemail.smtpPass
), thena password is obtained using git-credential.
- —no-smtp-auth
Disable SMTP authentication. Short hand for
—smtp-auth=none
If set, specifies the outgoing SMTP server to use (e.g.
smtp.example.com
or a raw IP address). Alternatively it canspecify a full pathname of a sendmail-like program instead;the program must support the-i
option. Default value canbe specified by thesendemail.smtpServer
configurationoption; the built-in default is to search forsendmail
in/usr/sbin
,/usr/lib
and $PATH if such program isavailable, falling back tolocalhost
otherwise.Specifies a port different from the default port (SMTPservers typically listen to smtp port 25, but may also listen tosubmission port 587, or the common SSL smtp port 465);symbolic port names (e.g. "submission" instead of 587)are also accepted. The port can also be set with the
sendemail.smtpServerPort
configuration variable.- If set, specifies the outgoing SMTP server option to use.Default value can be specified by the
sendemail.smtpServerOption
configuration option.
The —smtp-server-option option must be repeated for each option you wantto pass to the server. Likewise, different lines in the configuration filesmust be used for each option.
- —smtp-ssl
Legacy alias for —smtp-encryption ssl.
Path to a store of trusted CA certificates for SMTP SSL/TLScertificate validation (either a directory that has been processedby c_rehash, or a single file containing one or more PEM formatcertificates concatenated together: see verify(1) -CAfile and-CApath for more information on these). Set it to an empty stringto disable certificate verification. Defaults to the value of the
sendemail.smtpsslcertpath
configuration variable, if set, or thebacking SSL library’s compiled-in default otherwise (which shouldbe the best choice on most platforms).Username for SMTP-AUTH. Default is the value of
sendemail.smtpUser
;if a username is not specified (with—smtp-user
orsendemail.smtpUser
),then authentication is not attempted.Enable (1) or disable (0) debug output. If enabled, SMTPcommands and replies will be printed. Useful to debug TLSconnection and authentication problems.
Some email servers (e.g. smtp.163.com) limit the number emails to besent per session (connection) and this will lead to a failure whensending many messages. With this option, send-email will disconnect aftersending $
messages and wait for a few seconds (see —relogin-delay)and reconnect, to work around such a limit. You may want touse some form of credential helper to avoid having to retypeyour password every time this happens. Defaults to the sendemail.smtpBatchSize
configuration variable.- Waiting $
seconds before reconnecting to SMTP server. Used togetherwith —batch-size option. Defaults to the sendemail.smtpReloginDelay
configuration variable.
Automating
- —no-[to|cc|bcc]
Clears any list of "To:", "Cc:", "Bcc:" addresses previouslyset via config.
Clears the previously read value of
sendemail.identity
setvia config, if any.Specify a command to execute once per patch file whichshould generate patch file specific "To:" entries.Output of this command must be single email address per line.Default is the value of sendemail.tocmd configuration value.
Specify a command to execute once per patch file whichshould generate patch file specific "Cc:" entries.Output of this command must be single email address per line.Default is the value of
sendemail.ccCmd
configuration value.If this is set, each email will be sent as a reply to the previousemail sent. If disabled with "—no-chain-reply-to", all emails afterthe first will be sent as replies to the first email sent. When usingthis, it is recommended that the first file given be an overview of theentire patch series. Disabled by default, but the
sendemail.chainReplyTo
configuration variable can be used to enable it.A configuration identity. When given, causes values in thesendemail.
subsection to take precedence overvalues in the sendemail section. The default identity isthe value of sendemail.identity
.If this is set, add emails found in Signed-off-by: or Cc: lines to thecc list. Default is the value of
sendemail.signedoffbycc
configurationvalue; if that is unspecified, default to —signed-off-by-cc.If this is set, emails found in Cc: headers in the first patch ofthe series (typically the cover letter) are added to the cc listfor each email set. Default is the value of _sendemail.cccover_configuration value; if that is unspecified, default to —no-cc-cover.
If this is set, emails found in To: headers in the first patch ofthe series (typically the cover letter) are added to the to listfor each email set. Default is the value of _sendemail.tocover_configuration value; if that is unspecified, default to —no-to-cover.
- Specify an additional category of recipients to suppress theauto-cc of:
author will avoid including the patch author.
self will avoid including the sender.
cc will avoid including anyone mentioned in Cc lines in the patch headerexcept for self (use self for that).
bodycc will avoid including anyone mentioned in Cc lines in thepatch body (commit message) except for self (use self for that).
sob will avoid including anyone mentioned in Signed-off-by lines exceptfor self (use self for that).
misc-by will avoid including anyone mentioned in Acked-by,Reviewed-by, Tested-by and other "-by" lines in the patch body,except Signed-off-by (use sob for that).
cccmd will avoid running the —cc-cmd.
body is equivalent to sob + bodycc + misc-by.
all will suppress all auto cc values.
Default is the value of sendemail.suppresscc
configuration value; ifthat is unspecified, default to self if —suppress-from isspecified, as well as body if —no-signed-off-cc is specified.
- —[no-]suppress-from
If this is set, do not add the From: address to the cc: list.Default is the value of
sendemail.suppressFrom
configurationvalue; if that is unspecified, default to —no-suppress-from.- If this is set, the In-Reply-To and References headers will beadded to each email sent. Whether each mail refers to theprevious email (
deep
threading per _git format-patch_wording) or to the first email (shallow
threading) isgoverned by "—[no-]chain-reply-to".
If disabled with "—no-thread", those headers will not be added(unless specified with —in-reply-to). Default is the value of thesendemail.thread
configuration value; if that is unspecified,default to —thread.
It is up to the user to ensure that no In-Reply-To header alreadyexists when git send-email is asked to add it (especially note thatgit format-patch can be configured to do the threading itself).Failure to do so may not produce the expected result in therecipient’s MUA.
Administering
always will always confirm before sending
never will never confirm before sending
cc will confirm before sending when send-email has automaticallyadded addresses from the patch to the Cc list
compose will confirm before sending the first message when using —compose.
auto is equivalent to cc + compose
Default is the value of sendemail.confirm
configuration value; if thatis unspecified, default to auto unless any of the suppress optionshave been specified, in which case default to compose.
- —dry-run
Do everything except actually send the emails.
When an argument may be understood either as a reference or as a file name,choose to understand it as a format-patch argument (
—format-patch
)or as a file name (—no-format-patch
). By default, when such a conflictoccurs, git send-email will fail.Make git-send-email less verbose. One line per email should beall that is output.
- Perform sanity checks on patches.Currently, validation means the following:
Invoke the sendemail-validate hook if present (see githooks[5]).
Warn of patches that contain lines longer than998 characters unless a suitable transfer encoding(auto, base64, or quoted-printable) is used;this is due to SMTP limits as described byhttp://www.ietf.org/rfc/rfc5322.txt.
Default is the value of sendemail.validate
; if this is not set,default to —validate
.
Information
- —dump-aliases
- Instead of the normal operation, dump the shorthand alias names fromthe configured alias file(s), one per line in alphabetical order. Note,this only includes the alias name and not its expanded email addresses.See sendemail.aliasesfile for more information about aliases.
CONFIGURATION
- sendemail.aliasesFile
To avoid typing long email addresses, point this to one or moreemail aliases files. You must also supply
sendemail.aliasFileType
.- Format of the file(s) specified in sendemail.aliasesFile. Must beone of mutt, mailrc, pine, elm, or gnus, or sendmail.
What an alias file in each format looks like can be found inthe documentation of the email program of the same name. Thedifferences and limitations from the standard formats aredescribed below:
- sendmail
Quoted aliases and quoted addresses are not supported: lines thatcontain a
"
symbol are ignored.Redirection to a file (
/path/name
) or pipe (|command
) is notsupported.File inclusion (
:include: /path/name
) is not supported.Warnings are printed on the standard error output for anyexplicitly unsupported constructs, and any other lines that are notrecognized by the parser.
- sendemail.multiEdit
If true (default), a single editor instance will be spawned to editfiles you have to edit (patches when
—annotate
is used, and thesummary when—compose
is used). If false, files will be edited oneafter the other, spawning a new editor each time.- Sets the default for whether to confirm before sending. Must beone of always, never, cc, compose, or auto. See
—confirm
in the previous section for the meaning of these values.
EXAMPLES
Use gmail as the smtp server
To use git send-email to send your patches through the GMail SMTP server,edit ~/.gitconfig to specify your account settings:
- [sendemail]
- smtpEncryption = tls
- smtpServer = smtp.gmail.com
- smtpUser = yourname@gmail.com
- smtpServerPort = 587
If you have multifactor authentication setup on your gmail account, you willneed to generate an app-specific password for use with git send-email. Visithttps://security.google.com/settings/security/apppasswords to create it.
Once your commits are ready to be sent to the mailing list, run thefollowing commands:
- $ git format-patch --cover-letter -M origin/master -o outgoing/
- $ edit outgoing/0000-*
- $ git send-email outgoing/*
The first time you run it, you will be prompted for your credentials. Enter theapp-specific or your regular password as appropriate. If you have credentialhelper configured (see git-credential[1]), the password will be saved inthe credential store so you won’t have to type it the next time.
Note: the following core Perl modules that may be installed with yourdistribution of Perl are required:MIME::Base64, MIME::QuotedPrint, Net::Domain and Net::SMTP.These additional Perl modules are also required:Authen::SASL and Mail::Address.
SEE ALSO
git-format-patch[1], git-imap-send[1], mbox(5)
GIT
Part of the git[1] suite