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