1GIT-SEND-EMAIL(1) Git Manual GIT-SEND-EMAIL(1)
2
3
4
6 git-send-email - Send a collection of patches as emails
7
9 git send-email [<options>] <file|directory>...
10 git send-email [<options>] <format-patch options>
11 git send-email --dump-aliases
12
14 Takes the patches given on the command line and emails them out.
15 Patches can be specified as files, directories (which will send all
16 files in the directory), or directly as a revision list. In the last
17 case, any format accepted by git-format-patch(1) can be passed to git
18 send-email, as well as options understood by git-format-patch(1).
19
20 The header of the email is configurable via command-line options. If
21 not specified on the command line, the user will be prompted with a
22 ReadLine enabled interface to provide the necessary information.
23
24 There are two formats accepted for patch files:
25
26 1. mbox format files
27
28 This is what git-format-patch(1) generates. Most headers and MIME
29 formatting are ignored.
30
31 2. The original format used by Greg Kroah-Hartman’s
32 send_lots_of_email.pl script
33
34 This format expects the first line of the file to contain the "Cc:"
35 value and the "Subject:" of the message as the second line.
36
38 Composing
39 --annotate
40 Review and edit each patch you’re about to send. Default is the
41 value of sendemail.annotate. See the CONFIGURATION section for
42 sendemail.multiEdit.
43
44 --bcc=<address>,...
45 Specify a "Bcc:" value for each email. Default is the value of
46 sendemail.bcc.
47
48 This option may be specified multiple times.
49
50 --cc=<address>,...
51 Specify a starting "Cc:" value for each email. Default is the value
52 of sendemail.cc.
53
54 This option may be specified multiple times.
55
56 --compose
57 Invoke a text editor (see GIT_EDITOR in git-var(1)) to edit an
58 introductory message for the patch series.
59
60 When --compose is used, git send-email will use the From, To, Cc,
61 Bcc, Subject, Reply-To, and In-Reply-To headers specified in the
62 message. If the body of the message (what you type after the
63 headers and a blank line) only contains blank (or Git: prefixed)
64 lines, the summary won’t be sent, but the headers mentioned above
65 will be used unless they are removed.
66
67 Missing From or In-Reply-To headers will be prompted for.
68
69 See the CONFIGURATION section for sendemail.multiEdit.
70
71 --from=<address>
72 Specify the sender of the emails. If not specified on the command
73 line, the value of the sendemail.from configuration option is used.
74 If neither the command-line option nor sendemail.from are set, then
75 the user will be prompted for the value. The default for the prompt
76 will be the value of GIT_AUTHOR_IDENT, or GIT_COMMITTER_IDENT if
77 that is not set, as returned by "git var -l".
78
79 --reply-to=<address>
80 Specify the address where replies from recipients should go to. Use
81 this if replies to messages should go to another address than what
82 is specified with the --from parameter.
83
84 --in-reply-to=<identifier>
85 Make the first mail (or all the mails with --no-thread) appear as a
86 reply to the given Message-ID, which avoids breaking threads to
87 provide a new patch series. The second and subsequent emails will
88 be sent as replies according to the --[no-]chain-reply-to setting.
89
90 So for example when --thread and --no-chain-reply-to are specified,
91 the second and subsequent patches will be replies to the first one
92 like in the illustration below where [PATCH v2 0/3] is in reply to
93 [PATCH 0/2]:
94
95 [PATCH 0/2] Here is what I did...
96 [PATCH 1/2] Clean up and tests
97 [PATCH 2/2] Implementation
98 [PATCH v2 0/3] Here is a reroll
99 [PATCH v2 1/3] Clean up
100 [PATCH v2 2/3] New tests
101 [PATCH v2 3/3] Implementation
102
103 Only necessary if --compose is also set. If --compose is not set,
104 this will be prompted for.
105
106 --subject=<string>
107 Specify the initial subject of the email thread. Only necessary if
108 --compose is also set. If --compose is not set, this will be
109 prompted for.
110
111 --to=<address>,...
112 Specify the primary recipient of the emails generated. Generally,
113 this will be the upstream maintainer of the project involved.
114 Default is the value of the sendemail.to configuration value; if
115 that is unspecified, and --to-cmd is not specified, this will be
116 prompted for.
117
118 This option may be specified multiple times.
119
120 --8bit-encoding=<encoding>
121 When encountering a non-ASCII message or subject that does not
122 declare its encoding, add headers/quoting to indicate it is encoded
123 in <encoding>. Default is the value of the
124 sendemail.assume8bitEncoding; if that is unspecified, this will be
125 prompted for if any non-ASCII files are encountered.
126
127 Note that no attempts whatsoever are made to validate the encoding.
128
129 --compose-encoding=<encoding>
130 Specify encoding of compose message. Default is the value of the
131 sendemail.composeencoding; if that is unspecified, UTF-8 is
132 assumed.
133
134 --transfer-encoding=(7bit|8bit|quoted-printable|base64|auto)
135 Specify the transfer encoding to be used to send the message over
136 SMTP. 7bit will fail upon encountering a non-ASCII message.
137 quoted-printable can be useful when the repository contains files
138 that contain carriage returns, but makes the raw patch email file
139 (as saved from a MUA) much harder to inspect manually. base64 is
140 even more fool proof, but also even more opaque. auto will use 8bit
141 when possible, and quoted-printable otherwise.
142
143 Default is the value of the sendemail.transferEncoding
144 configuration value; if that is unspecified, default to auto.
145
146 --xmailer, --no-xmailer
147 Add (or prevent adding) the "X-Mailer:" header. By default, the
148 header is added, but it can be turned off by setting the
149 sendemail.xmailer configuration variable to false.
150
151 Sending
152 --envelope-sender=<address>
153 Specify the envelope sender used to send the emails. This is useful
154 if your default address is not the address that is subscribed to a
155 list. In order to use the From address, set the value to "auto". If
156 you use the sendmail binary, you must have suitable privileges for
157 the -f parameter. Default is the value of the
158 sendemail.envelopeSender configuration variable; if that is
159 unspecified, choosing the envelope sender is left to your MTA.
160
161 --sendmail-cmd=<command>
162 Specify a command to run to send the email. The command should be
163 sendmail-like; specifically, it must support the -i option. The
164 command will be executed in the shell if necessary. Default is the
165 value of sendemail.sendmailcmd. If unspecified, and if
166 --smtp-server is also unspecified, git-send-email will search for
167 sendmail in /usr/sbin, /usr/lib and $PATH.
168
169 --smtp-encryption=<encryption>
170 Specify in what way encrypting begins for the SMTP connection.
171 Valid values are ssl and tls. Any other value reverts to plain
172 (unencrypted) SMTP, which defaults to port 25. Despite the names,
173 both values will use the same newer version of TLS, but for
174 historic reasons have these names. ssl refers to "implicit"
175 encryption (sometimes called SMTPS), that uses port 465 by default.
176 tls refers to "explicit" encryption (often known as STARTTLS), that
177 uses port 25 by default. Other ports might be used by the SMTP
178 server, which are not the default. Commonly found alternative port
179 for tls and unencrypted is 587. You need to check your provider’s
180 documentation or your server configuration to make sure for your
181 own case. Default is the value of sendemail.smtpEncryption.
182
183 --smtp-domain=<FQDN>
184 Specifies the Fully Qualified Domain Name (FQDN) used in the
185 HELO/EHLO command to the SMTP server. Some servers require the FQDN
186 to match your IP address. If not set, git send-email attempts to
187 determine your FQDN automatically. Default is the value of
188 sendemail.smtpDomain.
189
190 --smtp-auth=<mechanisms>
191 Whitespace-separated list of allowed SMTP-AUTH mechanisms. This
192 setting forces using only the listed mechanisms. Example:
193
194 $ git send-email --smtp-auth="PLAIN LOGIN GSSAPI" ...
195
196 If at least one of the specified mechanisms matches the ones
197 advertised by the SMTP server and if it is supported by the
198 utilized SASL library, the mechanism is used for authentication. If
199 neither sendemail.smtpAuth nor --smtp-auth is specified, all
200 mechanisms supported by the SASL library can be used. The special
201 value none maybe specified to completely disable authentication
202 independently of --smtp-user
203
204 --smtp-pass[=<password>]
205 Password for SMTP-AUTH. The argument is optional: If no argument is
206 specified, then the empty string is used as the password. Default
207 is the value of sendemail.smtpPass, however --smtp-pass always
208 overrides this value.
209
210 Furthermore, passwords need not be specified in configuration files
211 or on the command line. If a username has been specified (with
212 --smtp-user or a sendemail.smtpUser), but no password has been
213 specified (with --smtp-pass or sendemail.smtpPass), then a password
214 is obtained using git-credential.
215
216 --no-smtp-auth
217 Disable SMTP authentication. Short hand for --smtp-auth=none
218
219 --smtp-server=<host>
220 If set, specifies the outgoing SMTP server to use (e.g.
221 smtp.example.com or a raw IP address). If unspecified, and if
222 --sendmail-cmd is also unspecified, the default is to search for
223 sendmail in /usr/sbin, /usr/lib and $PATH if such a program is
224 available, falling back to localhost otherwise.
225
226 For backward compatibility, this option can also specify a full
227 pathname of a sendmail-like program instead; the program must
228 support the -i option. This method does not support passing
229 arguments or using plain command names. For those use cases,
230 consider using --sendmail-cmd instead.
231
232 --smtp-server-port=<port>
233 Specifies a port different from the default port (SMTP servers
234 typically listen to smtp port 25, but may also listen to submission
235 port 587, or the common SSL smtp port 465); symbolic port names
236 (e.g. "submission" instead of 587) are also accepted. The port can
237 also be set with the sendemail.smtpServerPort configuration
238 variable.
239
240 --smtp-server-option=<option>
241 If set, specifies the outgoing SMTP server option to use. Default
242 value can be specified by the sendemail.smtpServerOption
243 configuration option.
244
245 The --smtp-server-option option must be repeated for each option
246 you want to pass to the server. Likewise, different lines in the
247 configuration files must be used for each option.
248
249 --smtp-ssl
250 Legacy alias for --smtp-encryption ssl.
251
252 --smtp-ssl-cert-path
253 Path to a store of trusted CA certificates for SMTP SSL/TLS
254 certificate validation (either a directory that has been processed
255 by c_rehash, or a single file containing one or more PEM format
256 certificates concatenated together: see verify(1) -CAfile and
257 -CApath for more information on these). Set it to an empty string
258 to disable certificate verification. Defaults to the value of the
259 sendemail.smtpsslcertpath configuration variable, if set, or the
260 backing SSL library’s compiled-in default otherwise (which should
261 be the best choice on most platforms).
262
263 --smtp-user=<user>
264 Username for SMTP-AUTH. Default is the value of sendemail.smtpUser;
265 if a username is not specified (with --smtp-user or
266 sendemail.smtpUser), then authentication is not attempted.
267
268 --smtp-debug=0|1
269 Enable (1) or disable (0) debug output. If enabled, SMTP commands
270 and replies will be printed. Useful to debug TLS connection and
271 authentication problems.
272
273 --batch-size=<num>
274 Some email servers (e.g. smtp.163.com) limit the number emails to
275 be sent per session (connection) and this will lead to a failure
276 when sending many messages. With this option, send-email will
277 disconnect after sending $<num> messages and wait for a few seconds
278 (see --relogin-delay) and reconnect, to work around such a limit.
279 You may want to use some form of credential helper to avoid having
280 to retype your password every time this happens. Defaults to the
281 sendemail.smtpBatchSize configuration variable.
282
283 --relogin-delay=<int>
284 Waiting $<int> seconds before reconnecting to SMTP server. Used
285 together with --batch-size option. Defaults to the
286 sendemail.smtpReloginDelay configuration variable.
287
288 Automating
289 --no-[to|cc|bcc]
290 Clears any list of "To:", "Cc:", "Bcc:" addresses previously set
291 via config.
292
293 --no-identity
294 Clears the previously read value of sendemail.identity set via
295 config, if any.
296
297 --to-cmd=<command>
298 Specify a command to execute once per patch file which should
299 generate patch file specific "To:" entries. Output of this command
300 must be single email address per line. Default is the value of
301 sendemail.tocmd configuration value.
302
303 --cc-cmd=<command>
304 Specify a command to execute once per patch file which should
305 generate patch file specific "Cc:" entries. Output of this command
306 must be single email address per line. Default is the value of
307 sendemail.ccCmd configuration value.
308
309 --header-cmd=<command>
310 Specify a command that is executed once per outgoing message and
311 output RFC 2822 style header lines to be inserted into them. When
312 the sendemail.headerCmd configuration variable is set, its value is
313 always used. When --header-cmd is provided at the command line, its
314 value takes precedence over the sendemail.headerCmd configuration
315 variable.
316
317 --no-header-cmd
318 Disable any header command in use.
319
320 --[no-]chain-reply-to
321 If this is set, each email will be sent as a reply to the previous
322 email sent. If disabled with "--no-chain-reply-to", all emails
323 after the first will be sent as replies to the first email sent.
324 When using this, it is recommended that the first file given be an
325 overview of the entire patch series. Disabled by default, but the
326 sendemail.chainReplyTo configuration variable can be used to enable
327 it.
328
329 --identity=<identity>
330 A configuration identity. When given, causes values in the
331 sendemail.<identity> subsection to take precedence over values in
332 the sendemail section. The default identity is the value of
333 sendemail.identity.
334
335 --[no-]signed-off-by-cc
336 If this is set, add emails found in the Signed-off-by trailer or
337 Cc: lines to the cc list. Default is the value of
338 sendemail.signedoffbycc configuration value; if that is
339 unspecified, default to --signed-off-by-cc.
340
341 --[no-]cc-cover
342 If this is set, emails found in Cc: headers in the first patch of
343 the series (typically the cover letter) are added to the cc list
344 for each email set. Default is the value of sendemail.cccover
345 configuration value; if that is unspecified, default to
346 --no-cc-cover.
347
348 --[no-]to-cover
349 If this is set, emails found in To: headers in the first patch of
350 the series (typically the cover letter) are added to the to list
351 for each email set. Default is the value of sendemail.tocover
352 configuration value; if that is unspecified, default to
353 --no-to-cover.
354
355 --suppress-cc=<category>
356 Specify an additional category of recipients to suppress the
357 auto-cc of:
358
359 • author will avoid including the patch author.
360
361 • self will avoid including the sender.
362
363 • cc will avoid including anyone mentioned in Cc lines in the
364 patch header except for self (use self for that).
365
366 • bodycc will avoid including anyone mentioned in Cc lines in the
367 patch body (commit message) except for self (use self for
368 that).
369
370 • sob will avoid including anyone mentioned in the Signed-off-by
371 trailers except for self (use self for that).
372
373 • misc-by will avoid including anyone mentioned in Acked-by,
374 Reviewed-by, Tested-by and other "-by" lines in the patch body,
375 except Signed-off-by (use sob for that).
376
377 • cccmd will avoid running the --cc-cmd.
378
379 • body is equivalent to sob + bodycc + misc-by.
380
381 • all will suppress all auto cc values.
382
383 Default is the value of sendemail.suppresscc configuration value;
384 if that is unspecified, default to self if --suppress-from is
385 specified, as well as body if --no-signed-off-cc is specified.
386
387 --[no-]suppress-from
388 If this is set, do not add the From: address to the cc: list.
389 Default is the value of sendemail.suppressFrom configuration value;
390 if that is unspecified, default to --no-suppress-from.
391
392 --[no-]thread
393 If this is set, the In-Reply-To and References headers will be
394 added to each email sent. Whether each mail refers to the previous
395 email (deep threading per git format-patch wording) or to the first
396 email (shallow threading) is governed by "--[no-]chain-reply-to".
397
398 If disabled with "--no-thread", those headers will not be added
399 (unless specified with --in-reply-to). Default is the value of the
400 sendemail.thread configuration value; if that is unspecified,
401 default to --thread.
402
403 It is up to the user to ensure that no In-Reply-To header already
404 exists when git send-email is asked to add it (especially note that
405 git format-patch can be configured to do the threading itself).
406 Failure to do so may not produce the expected result in the
407 recipient’s MUA.
408
409 Administering
410 --confirm=<mode>
411 Confirm just before sending:
412
413 • always will always confirm before sending
414
415 • never will never confirm before sending
416
417 • cc will confirm before sending when send-email has
418 automatically added addresses from the patch to the Cc list
419
420 • compose will confirm before sending the first message when
421 using --compose.
422
423 • auto is equivalent to cc + compose
424
425 Default is the value of sendemail.confirm configuration value; if
426 that is unspecified, default to auto unless any of the suppress
427 options have been specified, in which case default to compose.
428
429 --dry-run
430 Do everything except actually send the emails.
431
432 --[no-]format-patch
433 When an argument may be understood either as a reference or as a
434 file name, choose to understand it as a format-patch argument
435 (--format-patch) or as a file name (--no-format-patch). By default,
436 when such a conflict occurs, git send-email will fail.
437
438 --quiet
439 Make git-send-email less verbose. One line per email should be all
440 that is output.
441
442 --[no-]validate
443 Perform sanity checks on patches. Currently, validation means the
444 following:
445
446 • Invoke the sendemail-validate hook if present (see
447 githooks(5)).
448
449 • Warn of patches that contain lines longer than 998 characters
450 unless a suitable transfer encoding (auto, base64, or
451 quoted-printable) is used; this is due to SMTP limits as
452 described by http://www.ietf.org/rfc/rfc5322.txt.
453
454 Default is the value of sendemail.validate; if this is not set,
455 default to --validate.
456
457 --force
458 Send emails even if safety checks would prevent it.
459
460 Information
461 --dump-aliases
462 Instead of the normal operation, dump the shorthand alias names
463 from the configured alias file(s), one per line in alphabetical
464 order. Note that this only includes the alias name and not its
465 expanded email addresses. See sendemail.aliasesfile for more
466 information about aliases.
467
469 Everything below this line in this section is selectively included from
470 the git-config(1) documentation. The content is the same as what’s
471 found there:
472
473 sendemail.identity
474 A configuration identity. When given, causes values in the
475 sendemail.<identity> subsection to take precedence over values in
476 the sendemail section. The default identity is the value of
477 sendemail.identity.
478
479 sendemail.smtpEncryption
480 See git-send-email(1) for description. Note that this setting is
481 not subject to the identity mechanism.
482
483 sendemail.smtpsslcertpath
484 Path to ca-certificates (either a directory or a single file). Set
485 it to an empty string to disable certificate verification.
486
487 sendemail.<identity>.*
488 Identity-specific versions of the sendemail.* parameters found
489 below, taking precedence over those when this identity is selected,
490 through either the command-line or sendemail.identity.
491
492 sendemail.multiEdit
493 If true (default), a single editor instance will be spawned to edit
494 files you have to edit (patches when --annotate is used, and the
495 summary when --compose is used). If false, files will be edited one
496 after the other, spawning a new editor each time.
497
498 sendemail.confirm
499 Sets the default for whether to confirm before sending. Must be one
500 of always, never, cc, compose, or auto. See --confirm in the git-
501 send-email(1) documentation for the meaning of these values.
502
503 sendemail.aliasesFile
504 To avoid typing long email addresses, point this to one or more
505 email aliases files. You must also supply sendemail.aliasFileType.
506
507 sendemail.aliasFileType
508 Format of the file(s) specified in sendemail.aliasesFile. Must be
509 one of mutt, mailrc, pine, elm, gnus, or sendmail.
510
511 What an alias file in each format looks like can be found in the
512 documentation of the email program of the same name. The
513 differences and limitations from the standard formats are described
514 below:
515
516 sendmail
517
518 • Quoted aliases and quoted addresses are not supported:
519 lines that contain a " symbol are ignored.
520
521 • Redirection to a file (/path/name) or pipe (|command) is
522 not supported.
523
524 • File inclusion (:include: /path/name) is not supported.
525
526 • Warnings are printed on the standard error output for any
527 explicitly unsupported constructs, and any other lines that
528 are not recognized by the parser.
529
530 sendemail.annotate, sendemail.bcc, sendemail.cc, sendemail.ccCmd,
531 sendemail.chainReplyTo, sendemail.envelopeSender, sendemail.from,
532 sendemail.headerCmd, sendemail.signedoffbycc, sendemail.smtpPass,
533 sendemail.suppresscc, sendemail.suppressFrom, sendemail.to,
534 sendemail.tocmd, sendemail.smtpDomain, sendemail.smtpServer,
535 sendemail.smtpServerPort, sendemail.smtpServerOption,
536 sendemail.smtpUser, sendemail.thread, sendemail.transferEncoding,
537 sendemail.validate, sendemail.xmailer
538 These configuration variables all provide a default for git-send-
539 email(1) command-line options. See its documentation for details.
540
541 sendemail.signedoffcc (deprecated)
542 Deprecated alias for sendemail.signedoffbycc.
543
544 sendemail.smtpBatchSize
545 Number of messages to be sent per connection, after that a relogin
546 will happen. If the value is 0 or undefined, send all messages in
547 one connection. See also the --batch-size option of git-send-
548 email(1).
549
550 sendemail.smtpReloginDelay
551 Seconds to wait before reconnecting to the smtp server. See also
552 the --relogin-delay option of git-send-email(1).
553
554 sendemail.forbidSendmailVariables
555 To avoid common misconfiguration mistakes, git-send-email(1) will
556 abort with a warning if any configuration options for "sendmail"
557 exist. Set this variable to bypass the check.
558
560 Use gmail as the smtp server
561 To use git send-email to send your patches through the GMail SMTP
562 server, edit ~/.gitconfig to specify your account settings:
563
564 [sendemail]
565 smtpEncryption = tls
566 smtpServer = smtp.gmail.com
567 smtpUser = yourname@gmail.com
568 smtpServerPort = 587
569
570 If you have multi-factor authentication set up on your Gmail account,
571 you can generate an app-specific password for use with git send-email.
572 Visit https://security.google.com/settings/security/apppasswords to
573 create it.
574
575 Once your commits are ready to be sent to the mailing list, run the
576 following commands:
577
578 $ git format-patch --cover-letter -M origin/master -o outgoing/
579 $ edit outgoing/0000-*
580 $ git send-email outgoing/*
581
582 The first time you run it, you will be prompted for your credentials.
583 Enter the app-specific or your regular password as appropriate. If you
584 have credential helper configured (see git-credential(1)), the password
585 will be saved in the credential store so you won’t have to type it the
586 next time.
587
588 Note: the following core Perl modules that may be installed with your
589 distribution of Perl are required: MIME::Base64, MIME::QuotedPrint,
590 Net::Domain and Net::SMTP. These additional Perl modules are also
591 required: Authen::SASL and Mail::Address.
592
594 git-format-patch(1), git-imap-send(1), mbox(5)
595
597 Part of the git(1) suite
598
599
600
601Git 2.43.0 11/20/2023 GIT-SEND-EMAIL(1)