This patch series does the following things: Firstly it basically makes the imap-send command usable again since it was broken because of not being able to correctly parse the config file. Further it adds support for OAuth2.0 and PLAIN authentication to git imap-send. Last, it does some minor improvements including adding the ability to specify the folder using the command line and ability to list the available folders by adding a `--list` option. P.S.: I am surprised this thing even exists xD. v2: - Added support for OAuth2.0 with curl. - Fixed the memory leak in case auth_cram_md5 fails. v3: - Improve wording in first patch - Change misleading message if OAuth2.0 is used without OpenSSL v4: - Add PLAIN authentication mechanism for OpenSSL - Improved wording in the first patch a bit more v5: - Add ability to specify destination folder using the command line - Add ability to set a default between curl and openssl using the config v6: - Fix minor mistakes in --folder documentation v7: - Fix spelling and grammar mistakes in logs shown to the user when running imap-send - Display port alongwith host when git credential is invoked and asks for a password - Display the destination mailbox when sending a message v8: - Drop the patch that enabled user to choose between libcurl and openssl using the config - Add ability to list the available folders by adding a `--list` option v9: - Encourage users to use OAuth2.0 for Gmail (similar change done for send-email docs). v10: - Fix comment styles - Fix failing tests v11: - Use lower case letters for the first word of a sendtence in an error message and avoid using full stops at the end of a sentence. v12: - Gracefully exit PLAIN, CRAM-MD5, OAUTHBEARER and XOAUTH2 authentication methods if OpenSSL support is not compiled in, but is requested by the user. - Use backticks for string literals. - Wrap documentation text to 75 columns. - End the last member of enum CAPABILITY with a trailing comma. v13: - Fix logic error which was using || instead of && when checking if the authentication method is neither XOAUTH2 nor OAUTHBEARER. Aditya Garg (10): imap-send: fix bug causing cfg->folder being set to NULL imap-send: add support for OAuth2.0 authentication imap-send: add PLAIN authentication method to OpenSSL imap-send: fix memory leak in case auth_cram_md5 fails imap-send: gracefully fail if CRAM-MD5 authentication is requested without OpenSSL imap-send: enable specifying the folder using the command line imap-send: fix minor mistakes in the logs imap-send: display port alongwith host when git credential is invoked imap-send: display the destination mailbox when sending a message imap-send: add ability to list the available folders Documentation/config/imap.adoc | 11 +- Documentation/git-imap-send.adoc | 68 ++++- imap-send.c | 425 +++++++++++++++++++++++++++---- 3 files changed, 441 insertions(+), 63 deletions(-) Range-diff against v12: -: ---------- > 1: 3e3ddf7077 imap-send: fix bug causing cfg->folder being set to NULL 1: ab12f713d2 ! 2: 0d28e337cf imap-send: add support for OAuth2.0 authentication @@ imap-send.c: static CURL *setup_curl(struct imap_server_conf *srvc, struct crede - curl_easy_setopt(curl, CURLOPT_PASSWORD, srvc->pass); + + if (!srvc->auth_method || -+ strcmp(srvc->auth_method, "XOAUTH2") || -+ strcmp(srvc->auth_method, "OAUTHBEARER")) ++ (strcmp(srvc->auth_method, "XOAUTH2") && ++ strcmp(srvc->auth_method, "OAUTHBEARER"))) + curl_easy_setopt(curl, CURLOPT_PASSWORD, srvc->pass); strbuf_addstr(&path, srvc->use_ssl ? "imaps://" : "imap://"); 2: ba9c3fb756 = 3: d934bdcb82 imap-send: add PLAIN authentication method to OpenSSL 3: 3d1a66da57 = 4: f2773c646f imap-send: fix memory leak in case auth_cram_md5 fails 4: 70bb9388b8 = 5: c111ee6bc1 imap-send: gracefully fail if CRAM-MD5 authentication is requested without OpenSSL 5: 0d00a5e135 = 6: f12713f24b imap-send: enable specifying the folder using the command line 6: 999c65438f = 7: d38caeae5e imap-send: fix minor mistakes in the logs 7: d0315aebd4 = 8: 3ba02f2b0c imap-send: display port alongwith host when git credential is invoked 8: 73352a18cf = 9: 6dbd0bf0bc imap-send: display the destination mailbox when sending a message 9: 36d50d01f0 = 10: f77f2423e1 imap-send: add ability to list the available folders -- 2.49.0.639.gf77f2423e1