| 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] [(--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 | `--list`:: |
| 59 | Run the IMAP LIST command to output a list of all the folders present. |
| 60 | |
| 61 | CONFIGURATION |
| 62 | ------------- |
| 63 | |
| 64 | To use the tool, `imap.folder` and either `imap.tunnel` or `imap.host` must be set |
| 65 | to appropriate values. |
| 66 | |
| 67 | include::includes/cmd-config-section-rest.adoc[] |
| 68 | |
| 69 | include::config/imap.adoc[] |
| 70 | |
| 71 | GETTING A LIST OF AVAILABLE FOLDERS |
| 72 | ----------------------------------- |
| 73 | |
| 74 | In order to send an email to a specific folder, you need to know the correct name of |
| 75 | intended folder in your mailbox. The names like "Junk", "Trash" etc. displayed by |
| 76 | various email clients need not be the actual names of the folders stored in the mail |
| 77 | server of your email provider. |
| 78 | |
| 79 | In order to get the correct folder name to be used with `git imap-send`, you can run |
| 80 | `git imap-send --list`. This will display a list of valid folder names. An example |
| 81 | of such an output when run on a Gmail account is: |
| 82 | |
| 83 | ......................... |
| 84 | * LIST (\HasNoChildren) "/" "INBOX" |
| 85 | * LIST (\HasChildren \Noselect) "/" "[Gmail]" |
| 86 | * LIST (\All \HasNoChildren) "/" "[Gmail]/All Mail" |
| 87 | * LIST (\Drafts \HasNoChildren) "/" "[Gmail]/Drafts" |
| 88 | * LIST (\HasNoChildren \Important) "/" "[Gmail]/Important" |
| 89 | * LIST (\HasNoChildren \Sent) "/" "[Gmail]/Sent Mail" |
| 90 | * LIST (\HasNoChildren \Junk) "/" "[Gmail]/Spam" |
| 91 | * LIST (\Flagged \HasNoChildren) "/" "[Gmail]/Starred" |
| 92 | * LIST (\HasNoChildren \Trash) "/" "[Gmail]/Trash" |
| 93 | ......................... |
| 94 | |
| 95 | Here, you can observe that the correct name for the "Junk" folder is `[Gmail]/Spam` |
| 96 | and for the "Trash" folder is `[Gmail]/Trash`. Similar logic can be used to determine |
| 97 | other folders as well. |
| 98 | |
| 99 | EXAMPLES |
| 100 | -------- |
| 101 | Using tunnel mode: |
| 102 | |
| 103 | .......................... |
| 104 | [imap] |
| 105 | folder = "INBOX.Drafts" |
| 106 | tunnel = "ssh -q -C user@example.com /usr/bin/imapd ./Maildir 2> /dev/null" |
| 107 | .......................... |
| 108 | |
| 109 | Using direct mode: |
| 110 | |
| 111 | ......................... |
| 112 | [imap] |
| 113 | folder = "INBOX.Drafts" |
| 114 | host = imap://imap.example.com |
| 115 | user = bob |
| 116 | pass = p4ssw0rd |
| 117 | ......................... |
| 118 | |
| 119 | Using direct mode with SSL: |
| 120 | |
| 121 | ......................... |
| 122 | [imap] |
| 123 | folder = "INBOX.Drafts" |
| 124 | host = imaps://imap.example.com |
| 125 | user = bob |
| 126 | pass = p4ssw0rd |
| 127 | port = 123 |
| 128 | ; sslVerify = false |
| 129 | ......................... |
| 130 | |
| 131 | |
| 132 | [NOTE] |
| 133 | You may want to use `sslVerify=false` |
| 134 | while troubleshooting, if you suspect that the reason you are |
| 135 | having trouble connecting is because the certificate you use at |
| 136 | the private server `example.com` you are trying to set up (or |
| 137 | have set up) may not be verified correctly. |
| 138 | |
| 139 | Using Gmail's IMAP interface: |
| 140 | |
| 141 | --------- |
| 142 | [imap] |
| 143 | folder = "[Gmail]/Drafts" |
| 144 | host = imaps://imap.gmail.com |
| 145 | user = user@gmail.com |
| 146 | port = 993 |
| 147 | --------- |
| 148 | |
| 149 | Gmail does not allow using your regular password for `git imap-send`. |
| 150 | If you have multi-factor authentication set up on your Gmail account, you |
| 151 | can generate an app-specific password for use with `git imap-send`. |
| 152 | Visit https://security.google.com/settings/security/apppasswords to create |
| 153 | it. Alternatively, use OAuth2.0 authentication as described below. |
| 154 | |
| 155 | [NOTE] |
| 156 | You might need to instead use: `folder = "[Google Mail]/Drafts"` if you get an error |
| 157 | that the "Folder doesn't exist". You can also run `git imap-send --list` to get a |
| 158 | list of available folders. |
| 159 | |
| 160 | [NOTE] |
| 161 | If your Gmail account is set to another language than English, the name of the "Drafts" |
| 162 | folder will be localized. |
| 163 | |
| 164 | If you want to use OAuth2.0 based authentication, you can specify |
| 165 | `OAUTHBEARER` or `XOAUTH2` mechanism in your config. It is more secure |
| 166 | than using app-specific passwords, and also does not enforce the need of |
| 167 | having multi-factor authentication. You will have to use an OAuth2.0 |
| 168 | access token in place of your password when using this authentication. |
| 169 | |
| 170 | --------- |
| 171 | [imap] |
| 172 | folder = "[Gmail]/Drafts" |
| 173 | host = imaps://imap.gmail.com |
| 174 | user = user@gmail.com |
| 175 | port = 993 |
| 176 | authmethod = OAUTHBEARER |
| 177 | --------- |
| 178 | |
| 179 | Using Outlook's IMAP interface: |
| 180 | |
| 181 | Unlike Gmail, Outlook only supports OAuth2.0 based authentication. Also, it |
| 182 | supports only `XOAUTH2` as the mechanism. |
| 183 | |
| 184 | --------- |
| 185 | [imap] |
| 186 | folder = "Drafts" |
| 187 | host = imaps://outlook.office365.com |
| 188 | user = user@outlook.com |
| 189 | port = 993 |
| 190 | authmethod = XOAUTH2 |
| 191 | --------- |
| 192 | |
| 193 | Once the commits are ready to be sent, run the following command: |
| 194 | |
| 195 | |
| 196 | --------- |
| 197 | $ git format-patch --cover-letter -M --stdout origin/master | git imap-send |
| 198 | --------- |
| 199 | |
| 200 | Just make sure to disable line wrapping in the email client (Gmail's web |
| 201 | interface will wrap lines no matter what, so you need to use a real |
| 202 | IMAP client). |
| 203 | |
| 204 | In case you are using OAuth2.0 authentication, it is easier to use credential |
| 205 | helpers to generate tokens. Credential helpers suggested in |
| 206 | linkgit:git-send-email[1] can be used for `git imap-send` as well. |
| 207 | |
| 208 | CAUTION |
| 209 | ------- |
| 210 | It is still your responsibility to make sure that the email message |
| 211 | sent by your email program meets the standards of your project. |
| 212 | Many projects do not like patches to be attached. Some mail |
| 213 | agents will transform patches (e.g. wrap lines, send them as |
| 214 | format=flowed) in ways that make them fail. You will get angry |
| 215 | flames ridiculing you if you don't check this. |
| 216 | |
| 217 | Thunderbird in particular is known to be problematic. Thunderbird |
| 218 | users may wish to visit this web page for more information: |
| 219 | https://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email |
| 220 | |
| 221 | SEE ALSO |
| 222 | -------- |
| 223 | linkgit:git-format-patch[1], linkgit:git-send-email[1], `mbox`(5) |
| 224 | |
| 225 | GIT |
| 226 | --- |
| 227 | Part of the linkgit:git[1] suite |