GIT-SEND-EMAIL(1)
๐ธ GIT-SEND-EMAIL(1) ๐ธ โ the Git Manual, bestie edition
okay so we're doing git-send-email today and honestly? it's giving "i mass-email patches to maintainers and it works every time" ๐
it lives in the Git Manual, section 1, and it is SO much less scary than it looks. sit with me.
โจ NAME โจ
git-send-email โ send a whole collection of patches as emails ๐งโจ
๐ SYNOPSIS ๐
git send-email [<options>] (<file>|<directory>)...
git send-email [<options>] <format-patch-options>
git send-email --dump-aliases
git send-email --translate-aliases
๐ฆ DESCRIPTION ๐ฆ
So what it does: it takes the patches you hand it on the command line and emails them out. that's it, that's the whole vibe. ๐
You can give it patches as:
- files ๐
- directories ๐ โ and yes, it'll send every single file in that directory, no cap
- a revision list, directly ๐
In that last case, anything git-format-patch(1) accepts can be passed straight to git send-email, and so can every option that git-format-patch(1) understands. slay.
The email header is configurable via command-line options. And if you don't specify it on the command line, you'll get prompted through a ReadLine-enabled interface to hand over the info it needs. it will literally just ask you, bestie, and you will answer. ๐ซถ
There are two formats accepted for patch files:
- mbox format files ๐ฆ
This is the one git-format-patch(1) generates. Most headers and MIME formatting get ignored.
- The original format used by Greg Kroah-Hartman's
send_lots_of_email.plscript ๐ง
This format expects the first line of the file to contain the Cc: value, and the Subject: of the message to be the second line. that's the whole contract, iykyk.
โจ OPTIONS โจ
๐ Composing ๐
--annotateโ review and edit every single patch you're about to send, main character energy. Default is the value ofsendemail.annotate. Forsendemail.multiEdit, go look at the CONFIGURATION section. ๐--bcc=<address>,...โ set aBcc:value for each email. Default is the value ofsendemail.bcc.
You can specify this option multiple times. ๐
--cc=<address>,...โ set a startingCc:value for each email. Default is the value ofsendemail.cc.
You can specify this option multiple times. ๐
--composeโ pops open a text editor (seeGIT_EDITORingit-var(1)) so you can write an introductory message for the patch series. โ๏ธโจ
When --compose is used, git send-email will use the From, To, Cc, Bcc, Subject, Reply-To, and In-Reply-To headers specified in the message. And if the body of the message (aka everything you type after the headers and that blank line) only contains blank lines or Git:-prefixed lines, then the summary won't be sent โ but those headers up above will still be used, unless you remove them.
Missing From or In-Reply-To headers will be prompted for. ๐ฃ๏ธ
For sendemail.multiEdit, see the CONFIGURATION section.
--from=<address>โ specify the sender of the emails. If you don't say it on the command line, the value of thesendemail.fromconfiguration option is used. If neither the command-line option norsendemail.fromare set, then you'll get prompted for it. And the default for that prompt will be the value ofGIT_AUTHOR_IDENT, orGIT_COMMITTER_IDENTif that one isn't set, as returned bygit var -l. ๐ชช--reply-to=<address>โ specify where replies from recipients should go. Use this when you want replies to messages to land somewhere other than whatever you set with the--fromparameter. โฉ๏ธ--in-reply-to=<identifier>โ makes the first mail (or all the mails, if you're using--no-thread) appear as a reply to the givenMessage-ID, which avoids breaking threads when you're providing a new patch series. The second and subsequent emails will be sent as replies according to the--[no-]chain-reply-tosetting. ๐งต
So for example, when --thread and --no-chain-reply-to are specified, the second and subsequent patches will be replies to the first one, like in the illustration 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 --compose is not set, this will be prompted for. ๐
--outlook-id-fix,--no-outlook-id-fixโ okay so here's the tea ๐ต: Microsoft Outlook SMTP servers discard theMessage-IDsent via email and assign a new randomMessage-ID, which breaks threads. rude, honestly.
With --outlook-id-fix, git send-email uses a mechanism specific to Outlook servers to learn the Message-ID the server assigned, so it can fix the threading. Use it only when you know that the server reports the rewritten Message-ID the same way Outlook servers do.
Without this option specified, the fix is done by default when talking to smtp.office365.com or smtp-mail.outlook.com. Use --no-outlook-id-fix to disable it even when talking to those two servers. ๐
--subject=<string>โ specify the initial subject of the email thread. Only necessary if--composeis also set. If--composeis not set, this will be prompted for. ๐ฌ--to=<address>,...โ specify the primary recipient of the emails generated. Generally this is gonna be the upstream maintainer of the project involved. Default is the value of thesendemail.toconfiguration value; and if that's unspecified, and--to-cmdis not specified, this will be prompted for. ๐
You can specify this option multiple times. ๐
--8bit-encoding=<encoding>โ when you run into a non-ASCII message or subject that doesn't declare its encoding, this adds headers/quoting to indicate it's encoded in<encoding>. Default is the value ofsendemail.assume8bitEncoding; if that's unspecified, this will be prompted for if any non-ASCII files are encountered.
โ ๏ธ Note that no attempts whatsoever are made to validate the encoding. it does not check. it does not care. it just trusts you. ๐
--compose-encoding=<encoding>โ specify the encoding of the compose message. Default is the value ofsendemail.composeEncoding; if that's unspecified,UTF-8is assumed. ๐--transfer-encoding=(7bit|8bit|quoted-printable|base64|auto)โ specify the transfer encoding used to send the message over SMTP.7bitwill fail upon encountering a non-ASCII message.quoted-printablecan be useful when the repository contains files that contain carriage returns, but it makes the raw patch email file (as saved from an MUA) much harder to inspect manually.base64is even more fool proof, but also even more opaque.autowill use8bitwhen possible, andquoted-printableotherwise.
Default is the value of the sendemail.transferEncoding configuration value; if that's unspecified, default to auto. ๐
--xmailer,--no-xmailerโ add (or prevent adding) theX-Mailer:header. By default the header is added, but it can be turned off by setting thesendemail.xmailerconfiguration variable tofalse. โ๏ธ
๐ค Sending ๐ค
--envelope-sender=<address>โ specify the envelope sender used to send the emails. This is useful if your default address isn't the address that's subscribed to a list. To use theFromaddress, set the value toauto. If you use thesendmailbinary, you must have suitable privileges for the-fparameter. Default is the value of thesendemail.envelopeSenderconfiguration variable; if that's unspecified, choosing the envelope sender is left to your MTA. ๐ซก--sendmail-cmd=<command>โ specify a command to run to send the email. The command should be sendmail-like; specifically, it must support the-ioption. The command will be executed in the shell if necessary. Default is the value ofsendemail.sendmailCmd. If unspecified, and if--smtp-serveris also unspecified,git send-emailwill search forsendmailin/usr/sbin,/usr/liband$PATH. ๐--smtp-encryption=<encryption>โ specify in what way encrypting begins for the SMTP connection. Valid values aresslandtls. Any other value reverts to plain (unencrypted) SMTP, which defaults to port25.
Despite the names, both values will use the same newer version of TLS, but for historic reasons they have these names.
sslrefers to "implicit" encryption (sometimes called SMTPS), which uses port465by default.tlsrefers to "explicit" encryption (often known as STARTTLS), which uses port25by default.
Other ports might be used by the SMTP server, which are not the default. A commonly found alternative port for tls and unencrypted is 587. You need to check your provider's documentation or your server configuration to make sure for your own case. Default is the value of sendemail.smtpEncryption. ๐
--smtp-domain=<FQDN>โ specify the Fully Qualified Domain Name (FQDN) used in theHELO/EHLOcommand to the SMTP server. Some servers require the FQDN to match your IP address. If not set,git send-emailattempts to determine your FQDN automatically. Default is the value ofsendemail.smtpDomain. ๐--smtp-auth=<mechanisms>โ whitespace-separated list of allowed SMTP-AUTH mechanisms. This setting forces 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 the SMTP server, and if it's supported by the utilized SASL library, that mechanism is used for authentication. If neither sendemail.smtpAuth nor --smtp-auth is specified, all mechanisms supported by the SASL library can be used. The special value none may be specified to completely disable authentication, independently of --smtp-user. ๐
--smtp-pass[=<password>]โ password for SMTP-AUTH. The argument is optional: if no argument is specified, then the empty string is used as the password. Default is the value ofsendemail.smtpPass, however--smtp-passalways overrides this value. ๐คซ
Furthermore, passwords need not be specified in configuration files or on the command line. If a username has been specified (with --smtp-user or a sendemail.smtpUser), but no password has been specified (with --smtp-pass or sendemail.smtpPass), then a password is obtained using git-credential(1). ๐ช
--no-smtp-authโ disable SMTP authentication. Short hand for--smtp-auth=none. ๐ซ--smtp-server=<host>โ specify the outgoing SMTP server to use (e.g.smtp.example.comor a raw IP address). If unspecified, and if--sendmail-cmdis also unspecified, the default is to search forsendmailin/usr/sbin,/usr/liband$PATHif such a program is available, falling back tolocalhostotherwise. ๐
For backward compatibility, this option can also specify a full pathname of a sendmail-like program instead; the program must support the -i option. This method does not support passing arguments or using plain command names. For those use cases, consider using --sendmail-cmd instead. ๐ก
โฆand bestie, there is SO much more where that came from. stay tuned, we're not done. ๐
--smtp-server-port=<port>โ bestie, this is how you pick a port that isn't the default one. SMTP servers usually camp out on smtp port25, but they might also be vibing on submission port587, or the super common SSL smtp port465. And yes, symbolic port names are accepted too (so likesubmissioninstead of587, cute right?). You can also set the port with thesendemail.smtpServerPortconfiguration variable. โจ--smtp-server-option=<option>โ set the outgoing SMTP server option to use. The default can be specified by thesendemail.smtpServerOptionconfiguration option.
okay so this one's a little needy: --smtp-server-option must be repeated for every single option you want to pass to the server. Same deal in config files โ every option gets its own line. No bundling, no shortcuts. ๐
--smtp-sslโ the legacy alias for--smtp-encryption ssl. It's giving "we keep it around for the old heads" ๐ซถ--smtp-ssl-cert-path <path>โ path to a store of trusted CA certificates, used for SMTP SSL/TLS certificate validation. It's either a directory that's been processed byc_rehash, or a single file with one or more PEM format certificates concatenated together. For the details on those, go read the description of the-CAfile <file>and the-CApath <dir>options ofhttps://docs.openssl.org/master/man1/openssl-verify/(that's OpenSSL's verify(1) manual page, iykyk). Set it to an empty string to disable certificate verification (โ ๏ธ do that on purpose, not by accident). Defaults to the value of thesendemail.smtpSSLCertPathconfiguration variable, if set, or the backing SSL library's compiled-in default otherwise โ which should be the best choice on most platforms. ๐--smtp-ssl-client-cert <path>โ path to the client certificate file to present if the server asks for it. This option is required when the server is set up to verify client certificates. If the corresponding private key is not included in the file, you gotta supply it using thesendemail.smtpSSLClientKeyconfiguration variable or the--smtp-ssl-client-keyoption. Defaults to the value of thesendemail.smtpSSLClientCertconfiguration variable, if set. ๐--smtp-ssl-client-key <path>โ path to the client private key file that corresponds to the client certificate. To avoid misconfiguration, this option must be used in conjunction with thesendemail.smtpSSLClientKeyconfiguration variable or the--smtp-ssl-client-certoption. If the client key is included in the client certificate, the choice of private key depends on the format of the certificate โ visithttps://metacpan.org/pod/IO::Socket::SSLfor more details. Defaults to the value of thesendemail.smtpSSLClientKeyconfiguration variable, if set. ๐--smtp-user=<user>โ username for SMTP-AUTH. The default is the value ofsendemail.smtpUser; and if a username is not specified (with--smtp-userorsendemail.smtpUser), then authentication is simply not attempted. No username, no auth, no drama. ๐--smtp-debug=(0|1)โ turn debug output on (1) or off (0). When it's on, SMTP commands and replies get printed out. Genuinely useful for debugging TLS connection and authentication problems. It's giving detective mode ๐--imap-sent-folder=<folder>โ some email providers (e.g. iCloud) do not send a copy of the emails you send using SMTP to the Sent folder or similar in your mailbox. Rude honestly. So use this option to havegit imap-sendsend a copy of the emails to the folder you specify here. You can rungit imap-send --listto get a list of valid folder names, including the correct name of the Sent folder in your mailbox. You can also use this option to send emails to a dedicated IMAP folder of your choice. ๐ธ
This feature requires setting up git imap-send. See git-imap-send(1) for instructions.
--use-imap-only,--no-use-imap-onlyโ if this is set, all emails will only be copied to the IMAP folder specified with--imap-sent-folderorsendemail.imapSentFolder, and will not be sent to the recipients. Super useful if you just want to create a draft of the emails and use another email client to send them. If disabled with--no-use-imap-only, the emails will be sent like usual. Disabled by default, but thesendemail.useImapOnlyconfiguration variable can be used to enable it. โจ
This feature requires setting up git imap-send. See git-imap-send(1) for instructions.
--batch-size=<num>โ some email servers (e.g.smtp.163.com) limit the number of emails you can send per session (connection), and that will lead to a failure when you're sending many messages. With this option,send-emailwill disconnect after sending<num>messages, wait for a few seconds (see--relogin-delay), and reconnect โ working around the limit like a legend. You may want to use some form of credential helper to avoid having to retype your password every time this happens. Defaults to thesendemail.smtpBatchSizeconfiguration variable. ๐ฅ--relogin-delay=<int>โ wait<int>seconds before reconnecting to the SMTP server. Used together with the--batch-sizeoption. Defaults to thesendemail.smtpReloginDelayconfiguration variable. โณ
โจ Automating โจ
--no-to,--no-cc,--no-bccโ clear any list ofTo:,Cc:,Bcc:addresses that were previously set via config. Fresh slate energy ๐งน--no-identityโ clear the previously read value ofsendemail.identityset via config, if any.--to-cmd=<command>โ specify a command to execute once per patch file, which should generate patch-file-specificTo:entries. The output of this command must be a single email address per line. Default is the value of thesendemail.toCmdconfiguration value.--cc-cmd=<command>โ specify a command to execute once per patch file, which should generate patch-file-specificCc:entries. The output of this command must be a single email address per line. Default is the value of thesendemail.ccCmdconfiguration value.--header-cmd=<command>โ specify a command that's executed once per outgoing message, and outputs RFC 2822 style header lines to be inserted into them. When thesendemail.headerCmdconfiguration variable is set, its value is always used. When--header-cmdis provided at the command line, its value takes precedence over thesendemail.headerCmdconfiguration variable. Command line stays winning ๐--no-header-cmdโ disable any header command currently in use.--chain-reply-to,--no-chain-reply-toโ if this is set, each email will be sent as a reply to the previous email sent. If disabled with--no-chain-reply-to, all emails after the first will be sent as replies to the first email sent. When using that, it's recommended that the first file you give be an overview of the entire patch series. Disabled by default, but thesendemail.chainReplyToconfiguration variable can be used to enable it. ๐ฆ--identity=<identity>โ a configuration identity. When given, it causes values in thesendemail.<identity>subsection to take precedence over values in thesendemailsection. The default identity is the value ofsendemail.identity.--signed-off-by-cc,--no-signed-off-by-ccโ if this is set, add emails found in theSigned-off-bytrailer orCc:lines to the cc list. Default is the value of thesendemail.signedOffByCcconfiguration value; if that's unspecified, it defaults to--signed-off-by-cc.--cc-cover,--no-cc-coverโ if this is set, emails found inCc:headers in the first patch of the series (typically the cover letter) are added to the cc list for each email set. Default is the value of thesendemail.ccCoverconfiguration value; if that's unspecified, it defaults to--no-cc-cover.--to-cover,--no-to-coverโ if this is set, emails found inTo:headers in the first patch of the series (typically the cover letter) are added to the to list for each email set. Default is the value of thesendemail.toCoverconfiguration value; if that's unspecified, it defaults to--no-to-cover.--suppress-cc=<category>โ specify an additional category of recipients to suppress the auto-cc of:authorwill avoid including the patch author.selfwill avoid including the sender.ccwill avoid including anyone mentioned inCclines in the patch header, except for self (useselffor that).bodyccwill avoid including anyone mentioned inCclines in the patch body (commit message), except for self (useselffor that).sobwill avoid including anyone mentioned in theSigned-off-bytrailers, except for self (useselffor that).misc-bywill avoid including anyone mentioned inAcked-by,Reviewed-by,Tested-byand other "-by" lines in the patch body, exceptSigned-off-by(usesobfor that).cccmdwill avoid running the--cc-cmd.bodyis equivalent tosob + bodycc + misc-by.allwill suppress all auto cc values.
Default is the value of the sendemail.suppressCc configuration value; if that's unspecified, it defaults to self if --suppress-from is specified, as well as body if --no-signed-off-by-cc is specified.
--suppress-from,--no-suppress-fromโ if this is set, do not add theFrom:address to theCc:list. Default is the value of thesendemail.suppressFromconfiguration value; if that's unspecified, it defaults to--no-suppress-from.--thread,--no-threadโ if this is set, theIn-Reply-ToandReferencesheaders will be added to each email sent. Whether each mail refers to the previous email (deep threading, per git format-patch wording) or to the first email (shallow threading) is governed 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 the sendemail.thread configuration value; if that's unspecified, it defaults to --thread.
โ ๏ธ It is up to you to ensure that noIn-Reply-Toheader already exists whengit send-emailis asked to add it (especially note thatgit format-patchcan be configured to do the threading itself). Failure to do so may not produce the expected result in the recipient's MUA. No cap, this one bites people. ๐
--mailmap,--no-mailmapโ use the mailmap file (see gitmailmap(5)) to map all addresses to their canonical real name and email address. Additional mailmap data specific togit send-emailmay be provided using thesendemail.mailmap.fileorsendemail.mailmap.blobconfiguration values. Defaults tosendemail.mailmap.
โจ Administering โจ
--confirm=<mode>โ confirm just before sending. Your options, bestie:alwayswill always confirm before sending.neverwill never confirm before sending.
ccโ bestie it's gonna double-check with you before sending wheneversend-emailhas automatically slid addresses from the patch into the Cc list ๐composeโ it asks you before sending the very first message when you're using--compose๐ซถautoโ this is literally justcc+composecombined, iconic behavior โจ
Default is whatever the sendemail.confirm config value says; if that's not set anywhere, it defaults to auto โ unless any of the suppress options got specified, in which case it defaults to compose instead. Sneaky but true ๐
--dry-runโ do literally everything except the one thing: actually sending the emails. Rehearsal mode, no cap ๐ญ--format-patch,--no-format-patchโ when an argument could be read either as a reference or as a file name, this picks a lane:--format-patchmeans "treat it as a format-patch argument",--no-format-patchmeans "treat it as a file name" ๐๏ธ By default, when that conflict happens,git send-emailjust fails. It does not pick for you, it is not your mom.--quietโ makesgit send-emailless chatty. One line per email, that's the whole output. Minimalist queen ๐ธ--validate,--no-validateโ runs sanity checks on your patches. Right now "validation" means these two things:- It invokes the
sendemail-validatehook if one exists (peepgithooks(5)๐). - It warns you about patches containing lines longer than 998 characters, unless a suitable transfer encoding (
auto,base64, orquoted-printable) is in play โ this is because of SMTP limits, as described by https://www.ietf.org/rfc/rfc5322.txt ๐
- It invokes the
Default is the value of sendemail.validate; if that's not set, it defaults to --validate.
--forceโ send those emails even when the safety checks are actively trying to stop you. It's giving "I know better" energy ๐จ
๐ Information ๐
--dump-aliasesโ instead of doing the normal thing, it dumps the shorthand alias names out of the configured alias file(s), one per line, in alphabetical order ๐ค Heads up: this only includes the alias name, not its expanded email addresses. Seesendemail.aliasesFilefor more about aliases.--translate-aliasesโ instead of the normal thing, it reads from standard input and interprets each line as an email alias, translating it according to the configured alias file(s) ๐ง Then it outputs each translated name and email address to standard output, one per line. Seesendemail.aliasFilefor more information about aliases.
โ๏ธ CONFIGURATION โ๏ธ
Okay so literally everything below this line in this section is selectively pulled from the git-config(1) documentation. The content is the same as what's over there, fr fr:
sendemail.identityโ a configuration identity ๐ชช When you give one, it makes values in thesendemail.<identity>subsection take precedence over values in thesendemailsection. The default identity is the value ofsendemail.identity.sendemail.smtpEncryptionโ seegit-send-email(1)for the description. Note that this setting is not subject to the identity mechanism ๐sendemail.smtpSSLCertPathโ path to ca-certificates (either a directory or a single file) ๐ Set it to an empty string to disable certificate verification. That's your call bestie.sendemail.smtpSSLClientCertโ path to the client certificate file to present if the server asks for it ๐ This is required when the server is set up to verify client certificates. If the corresponding private key isn't included in the file, it must be supplied usingsendemail.smtpSSLClientKeyor the--smtp-ssl-client-keyoption.sendemail.smtpSSLClientKeyโ path to the client private key file that corresponds to the client certificate ๐๏ธ To avoid misconfiguration, this config must be used together withsendemail.smtpSSLClientCertor the--smtp-ssl-client-certoption. If the client key is included in the client certificate, which private key gets chosen depends on the format of the certificate. Visit https://metacpan.org/pod/IO::Socket::SSL for more details.sendemail.<identity>.<config>โ identity-specific versions of thesendemail.<config>parameters found below, taking precedence over those when this identity is selected, whether that's through the command-line or throughsendemail.identity๐ซsendemail.multiEditโ if true (which is the default), a single editor instance gets spawned to edit the files you have to edit (patches when--annotateis used, and the summary when--composeis used) ๐ If false, files get edited one after the other, spawning a brand new editor each and every time. Chaotic but valid.sendemail.confirmโ sets the default for whether to confirm before sending. Must be one ofalways,never,cc,compose, orauto. See--confirmin thegit-send-email(1)documentation for the meaning of these values ๐sendemail.mailmapโ if true, makesgit-send-email(1)assume--mailmap, otherwise assume--no-mailmap. False by default.sendemail.mailmap.fileโ the location of agit-send-email(1)-specific augmenting mailmap file ๐บ๏ธ The default mailmap andmailmap.fileare loaded first. So entries in this file take precedence over entries in the default mailmap locations. Seegitmailmap(5).sendemail.mailmap.blobโ likesendemail.mailmap.file, but the value is treated as a reference to a blob in the repository ๐ฆ Entries insendemail.mailmap.filetake precedence over entries here. Seegitmailmap(5).sendemail.aliasesFileโ to avoid typing out long email addresses, point this at one or more email aliases files ๐ฎ You must also supplysendemail.aliasFileType.sendemail.aliasFileTypeโ the format of the file(s) specified insendemail.aliasesFile. Must be one ofmutt,mailrc,pine,elm,gnus, orsendmail.
What an alias file in each format looks like can be found in the documentation of the email program of the same name. The differences and limitations from the standard formats are described below:
sendmail
- Quoted aliases and quoted addresses are not supported: lines that contain a
"symbol are ignored ๐ - Redirection to a file (
/path/name) or a pipe (|command) is not supported ๐ซ - File inclusion (
:include: /path/name) is not supported. - Warnings are printed on the standard error output for any explicitly unsupported constructs, and for any other lines that aren't recognized by the parser โ ๏ธ
sendemail.annotate,sendemail.bcc,sendemail.cc,sendemail.ccCmd,sendemail.chainReplyTo,sendemail.envelopeSender,sendemail.from,sendemail.headerCmd,sendemail.signedOffByCc,sendemail.smtpPass,sendemail.suppressCc,sendemail.suppressFrom,sendemail.to,sendemail.toCmd,sendemail.smtpDomain,sendemail.smtpServer,sendemail.smtpServerPort,sendemail.smtpServerOption,sendemail.smtpUser,sendemail.imapSentFolder,sendemail.useImapOnly,sendemail.thread,sendemail.transferEncoding,sendemail.validate,sendemail.xmailerโ all of these configuration variables provide a default forgit-send-email(1)command-line options ๐ See its documentation for details.sendemail.outlookidfixโ if true, makesgit-send-email(1)assume--outlook-id-fix, and if false assumes--no-outlook-id-fix. If it's not specified at all, it behaves the same way as if--outlook-id-fixwere not specified ๐คทโโ๏ธsendemail.signedOffCc(deprecated) โ deprecated alias forsendemail.signedOffByCc. It's giving legacy, do not use, periodt ๐sendemail.smtpBatchSizeโ number of messages to be sent per connection, after which a relogin will happen ๐ If the value is0or undefined, it sends all messages in one connection. See also the--batch-sizeoption ofgit-send-email(1).sendemail.smtpReloginDelayโ seconds to wait before reconnecting to the smtp server โณ See also the--relogin-delayoption ofgit-send-email(1).sendemail.forbidSendmailVariablesโ to avoid common misconfiguration mistakes,git-send-email(1)will abort with a warning if any configuration options for sendmail exist ๐ญ Set this variable to bypass the check.
๐ฌ EXAMPLES OF SMTP SERVERS ๐ฌ
โจ 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 = ssl
smtpServer = smtp.gmail.com
smtpUser = yourname@gmail.com
smtpServerPort = 465
Gmail does not allow using your regular password for git send-email ๐ซ If you have multi-factor authentication set up on your Gmail account, you can generate an app-specific password for use with git send-email. Visit https://security.google.com/settings/security/apppasswords to create it.
Alternatively, instead of using an app-specific password, you can use OAuth2.0 authentication with Gmail ๐ OAuth2.0 is more secure than app-specific passwords, and it works regardless of whether you have multi-factor authentication set up. OAUTHBEARER and XOAUTH2 are common mechanisms used for this type of authentication, and Gmail supports both of them ๐ As an example, if you want to use OAUTHBEARER, edit your ~/.gitconfig file and add smtpAuth = OAUTHBEARER to your account settings:
[sendemail]
smtpEncryption = ssl
smtpServer = smtp.gmail.com
smtpUser = yourname@gmail.com
smtpServerPort = 465
smtpAuth = OAUTHBEARER
Another alternative is using a tool developed by Google known as sendgmail[1] to send emails using git send-email ๐ ๏ธ
โจ Use Microsoft Outlook as the SMTP Server โจ
Unlike Gmail, Microsoft Outlook no longer supports app-specific passwords ๐ซ Therefore, OAuth2.0 authentication must be used for Outlook. Also, it only supports the XOAUTH2 authentication mechanism.
Edit ~/.gitconfig to specify your account settings for Outlook and use its SMTP server with git send-email:
[sendemail]
smtpEncryption = tls
smtpServer = smtp.office365.com
smtpUser = yourname@outlook.com
smtpServerPort = 587
smtpAuth = XOAUTH2
๐ SENDING PATCHES ๐
okay bestie, so your commits are ready to go to the mailing list?? LET'S GOOO. run these, in this order, no skipping:
$ git format-patch --cover-letter -M origin/master -o outgoing/
$ edit outgoing/0000-*
$ git send-email outgoing/*
the very first time you run it, it's gonna ask you for your credentials. type in your app-specific password or your regular password, whichever is the vibe for your setup. ๐
if you've got a credential helper configured (peep git-credential(1)), the password gets saved in the credential store so you don't have to type it again next time. iconic behaviour honestly. โจ
if you're on OAuth2.0 authentication, you need to use an access token in place of a password when prompted. there are various OAuth2.0 token generators available online, and community maintained credential helpers too:
git-credential-gmail[2] (cross platform, dedicated helper for authenticating Gmail accounts)git-credential-outlook[2] (cross platform, dedicated helper for authenticating Microsoft Outlook accounts)git-credential-yahoo[2] (cross platform, dedicated helper for authenticating Yahoo accounts)git-credential-aol[2] (cross platform, dedicated helper for authenticating AOL accounts)
you can also see gitcredentials(7) for more OAuth based authentication helpers. ๐ซถ
Proton Mail does not provide an SMTP server to send emails. if you're a paid customer of Proton Mail, you can use Proton Mail Bridge[3] โ officially provided by Proton Mail โ to create a local SMTP server for sending emails. and for both free and paid users, community maintained projects like git-protonmail[2] can be used. ๐ธ
Note: the following core Perl modules that may be installed with your distribution of Perl are required:
MIME::Base64[4], MIME::QuotedPrint[5], Net::Domain[6] and Net::SMTP[7].
These additional Perl modules are also required:
Authen::SASL[8] and Mail::Address[9].
โจ Exploiting the sendmailCmd option of git send-email โจ
apart from sending emails via an SMTP server, git send-email can also send emails through any application that supports sendmail-like commands. you can read documentation of --sendmail-cmd=<command> above for more info. this ability is so useful if you wanna use another application as an SMTP client for git send-email, or if your email provider uses proprietary APIs instead of SMTP to send emails. lowkey a superpower. ๐ฅ
as an example, let's see how to configure msmtp[10], a popular SMTP client found in many Linux distributions. edit ~/.gitconfig to instruct git-send-email to use it for sending emails.
[sendemail]
sendmailCmd = /usr/bin/msmtp # Change this to the path where msmtp is installed
links of a few such community maintained helpers are:
msmtp[10] (popular SMTP client with many features, available for Linux and macOS)git-protonmail[2] (cross platform client that can send emails using the ProtonMail API)git-msgraph[2] (cross platform client that can send emails using the Microsoft Graph API)
๐ CAVEATS ๐
okay bestie, sit down, we need to talk. the output from git-format-patch(1) can lead to a different commit message when applied with git-am(1). the patch that is applied may also be different from the one that was generated, or patch application may fail outright. not cute. ๐ญ
any line that is of the form:
- three-dashes and end-of-line, or
- a line that begins with
diff -, or - a line that begins with
`Index: `
is taken as the beginning of a patch, and the commit log message is terminated before the first occurrence of such a line.
note that this is especially problematic for unindented diffs that occur in the commit message; the diff in the commit message might get applied along with the patch section, or the patch application machinery might trip up because the patch target doesn't apply. this could for example be caused by a diff in a Markdown code block. ๐
the solution for this is to indent the diff or other text that could cause problems. periodt.
this loss of fidelity might be simple to notice if you're applying patches directly from a mailbox. however, changes originating from Git could be applied in bulk, in which case this would be much harder to notice. this could for example be a Linux distribution which uses patch files to apply changes on top of the commits from the upstream repositories. this goes to show that this behavior does not only impact email workflows. ๐
given these limitations, one might be tempted to use a general-purpose utility like patch(1) instead. however, patch(1) will not only look for unindented diffs (like git-am(1)) but will try to apply indented diffs as well. so yeah, pick your fighter wisely. โญ
๐ SEE ALSO ๐
git-format-patch(1), git-imap-send(1), mbox(5)
๐ง GIT ๐ง
Part of the git(1) suite
๐ NOTES ๐
- sendgmail https://github.com/google/gmail-oauth2-tools/tree/master/go/sendgmail
- git-credential-gmail https://github.com/AdityaGarg8/git-credential-email
- Proton Mail Bridge https://proton.me/mail/bridge
- MIME::Base64 https://metacpan.org/pod/MIME::Base64
- MIME::QuotedPrint https://metacpan.org/pod/MIME::QuotedPrint
- Net::Domain https://metacpan.org/pod/Net::Domain
- Net::SMTP https://metacpan.org/pod/Net::SMTP
- Authen::SASL https://metacpan.org/pod/Authen::SASL
- Mail::Address https://metacpan.org/pod/Mail::Address
- msmtp https://marlam.de/msmtp/
and that's a wrap on the whole page, bestie!! ๐ this lil masterpiece is from Git 2.56.0, dated 09/28/2026, and it lives at GIT-SEND-EMAIL(1). now go send some patches, you absolute icon. ๐๐ฆโจ
๐ฆ where this page comes from
- fedora 43: git-email 2.56.0-1.fc43 ยท BSD-3-Clause AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND MIT
- fedora 44: git-email 2.56.0-1.fc44 ยท BSD-3-Clause AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms