at commit a0189536

1 git-imap-send(1)
2 ================
3
4 NAME
5 ----
6 git-imap-send - Send a collection of patches from stdin to an IMAP folder
7
8
9 SYNOPSIS
10 --------
11 [synopsis]
12 git imap-send [-v] [-q] [--[no-]curl] [--[no-]draft] [(--folder|-f) <folder>]
13 git imap-send --list
14
15
16 DESCRIPTION
17 -----------
18 This command uploads a mailbox generated with `git format-patch`
19 into an IMAP drafts folder. This allows patches to be sent as
20 other email is when using mail clients that cannot read mailbox
21 files directly. The command also works with any general mailbox
22 in which emails have the fields `From`, `Date`, and `Subject` in
23 that order.
24
25 Typical usage is something like:
26
27 ----
28 $ git format-patch --signoff --stdout --attach origin | git imap-send
29 ----
30
31
32 OPTIONS
33 -------
34
35 `-v`::
36 `--verbose`::
37 Be verbose.
38
39 `-q`::
40 `--quiet`::
41 Be quiet.
42
43 `-f <folder>`::
44 `--folder=<folder>`::
45 Specify the folder in which the emails have to saved.
46 For example: `--folder=[Gmail]/Drafts` or `-f INBOX/Drafts`.
47
48 `--curl`::
49 Use libcurl to communicate with the IMAP server, unless tunneling
50 into it. Ignored if Git was built without the USE_CURL_FOR_IMAP_SEND
51 option set.
52
53 `--no-curl`::
54 Talk to the IMAP server using git's own IMAP routines instead of
55 using libcurl. Ignored if Git was built with the NO_OPENSSL option
56 set.
57
58 `--draft`::
59 `--no-draft`::
60 Mark uploaded messages with the IMAP `\Draft` flag. The default is `--no-draft`.
61 +
62 With libcurl, `--draft` requires version 8.13.0 or later.
63 Older libcurl still uploads the message but cannot set the flag.
64
65 `--list`::
66 Run the IMAP LIST command to output a list of all the folders present.
67
68 CONFIGURATION
69 -------------
70
71 To use the tool, `imap.folder` and either `imap.tunnel` or `imap.host` must be set
72 to appropriate values.
73
74 include::includes/cmd-config-section-rest.adoc[]
75
76 include::config/imap.adoc[]
77
78 GETTING A LIST OF AVAILABLE FOLDERS
79 -----------------------------------
80
81 In order to send an email to a specific folder, you need to know the correct name of
82 intended folder in your mailbox. The names like "Junk", "Trash" etc. displayed by
83 various email clients need not be the actual names of the folders stored in the mail
84 server of your email provider.
85
86 In order to get the correct folder name to be used with `git imap-send`, you can run
87 `git imap-send --list`. This will display a list of valid folder names. An example
88 of such an output when run on a Gmail account is:
89
90 .........................
91 * LIST (\HasNoChildren) "/" "INBOX"
92 * LIST (\HasChildren \Noselect) "/" "[Gmail]"
93 * LIST (\All \HasNoChildren) "/" "[Gmail]/All Mail"
94 * LIST (\Drafts \HasNoChildren) "/" "[Gmail]/Drafts"
95 * LIST (\HasNoChildren \Important) "/" "[Gmail]/Important"
96 * LIST (\HasNoChildren \Sent) "/" "[Gmail]/Sent Mail"
97 * LIST (\HasNoChildren \Junk) "/" "[Gmail]/Spam"
98 * LIST (\Flagged \HasNoChildren) "/" "[Gmail]/Starred"
99 * LIST (\HasNoChildren \Trash) "/" "[Gmail]/Trash"
100 .........................
101
102 Here, you can observe that the correct name for the "Junk" folder is `[Gmail]/Spam`
103 and for the "Trash" folder is `[Gmail]/Trash`. Similar logic can be used to determine
104 other folders as well.
105
106 EXAMPLES
107 --------
108 Using tunnel mode:
109
110 ..........................
111 [imap]
112 folder = "INBOX.Drafts"
113 tunnel = "ssh -q -C user@example.com /usr/bin/imapd ./Maildir 2> /dev/null"
114 ..........................
115
116 Using direct mode:
117
118 .........................
119 [imap]
120 folder = "INBOX.Drafts"
121 host = imap://imap.example.com
122 user = bob
123 pass = p4ssw0rd
124 .........................
125
126 Using direct mode with SSL:
127
128 .........................
129 [imap]
130 folder = "INBOX.Drafts"
131 host = imaps://imap.example.com
132 user = bob
133 pass = p4ssw0rd
134 port = 123
135 ; sslVerify = false
136 .........................
137
138
139 [NOTE]
140 You may want to use `sslVerify=false`
141 while troubleshooting, if you suspect that the reason you are
142 having trouble connecting is because the certificate you use at
143 the private server `example.com` you are trying to set up (or
144 have set up) may not be verified correctly.
145
146 Using Gmail's IMAP interface:
147
148 ----
149 [imap]
150 folder = "[Gmail]/Drafts"
151 host = imaps://imap.gmail.com
152 user = user@gmail.com
153 port = 993
154 ----
155
156 Gmail does not allow using your regular password for `git imap-send`.
157 If you have multi-factor authentication set up on your Gmail account, you
158 can generate an app-specific password for use with `git imap-send`.
159 Visit https://security.google.com/settings/security/apppasswords to create
160 it. Alternatively, use OAuth2.0 authentication as described below.
161
162 [NOTE]
163 You might need to instead use: `folder = "[Google Mail]/Drafts"` if you get an error
164 that the "Folder doesn't exist". You can also run `git imap-send --list` to get a
165 list of available folders.
166
167 [NOTE]
168 If your Gmail account is set to another language than English, the name of the "Drafts"
169 folder will be localized.
170
171 If you want to use OAuth2.0 based authentication, you can specify
172 `OAUTHBEARER` or `XOAUTH2` mechanism in your config. It is more secure
173 than using app-specific passwords, and also does not enforce the need of
174 having multi-factor authentication. You will have to use an OAuth2.0
175 access token in place of your password when using this authentication.
176
177 ----
178 [imap]
179 folder = "[Gmail]/Drafts"
180 host = imaps://imap.gmail.com
181 user = user@gmail.com
182 port = 993
183 authmethod = OAUTHBEARER
184 ----
185
186 Using Outlook's IMAP interface:
187
188 Unlike Gmail, Outlook only supports OAuth2.0 based authentication. Also, it
189 supports only `XOAUTH2` as the mechanism.
190
191 ----
192 [imap]
193 folder = "Drafts"
194 host = imaps://outlook.office365.com
195 user = user@outlook.com
196 port = 993
197 authmethod = XOAUTH2
198 ----
199
200 Once the commits are ready to be sent, run the following command:
201
202 ----
203 $ git format-patch --cover-letter -M --stdout origin/master | git imap-send
204 ----
205
206 Just make sure to disable line wrapping in the email client (Gmail's web
207 interface will wrap lines no matter what, so you need to use a real
208 IMAP client).
209
210 In case you are using OAuth2.0 authentication, it is easier to use credential
211 helpers to generate tokens. Credential helpers suggested in
212 linkgit:git-send-email[1] can be used for `git imap-send` as well.
213
214 CAUTION
215 -------
216 It is still your responsibility to make sure that the email message
217 sent by your email program meets the standards of your project.
218 Many projects do not like patches to be attached. Some mail
219 agents will transform patches (e.g. wrap lines, send them as
220 format=flowed) in ways that make them fail. You will get angry
221 flames ridiculing you if you don't check this.
222
223 Thunderbird in particular is known to be problematic. Thunderbird
224 users may wish to visit this web page for more information:
225 https://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email
226
227 SEE ALSO
228 --------
229 linkgit:git-format-patch[1], linkgit:git-send-email[1], `mbox`(5)
230
231 GIT
232 ---
233 Part of the linkgit:git[1] suite