Skip to contentSkip to conversation

Can git send-email support neomutt?

DISCUSSION Wu Zhenyu 2 participants 5 messages Nov 5, 2022 – Nov 6, 2022 1 message not in the archive

lore
Share & tools
lore

Wu Zhenyu

author
#0 lore raw

Excuse me.

I want to use neomutt as git send-email's cmd:

```
[sendemail]
	sendmailCmd = neomutt
```

However, I notice

```
my @sendmail_parameters = ('-i', @recipients);
...
exec ("sh", "-c", "$sendmail_cmd \"\$@\"", "-", @sendmail_parameters)
```

It call neomutt -i to@email from@email, which is an incorrect cmd for neomutt.

Can we customize sendmail-cmd more flexible? Like

```
[sendemail]
	sendmailCmd = neomutt %{to}
```

call neomutt [email protected].

Thanks!

Signature · 2 lines
Best Regards
Wu Zhenyu
#1 lore raw
Quoted 8 lines · Wu Zhenyu

Excuse me.

I want to use neomutt as git send-email's cmd:

```
[sendemail]
	sendmailCmd = neomutt
```

Mutt and Neomutt are MUAs, which stands for mail user agent. That is, they're mail clients that people use to read, compose, and send email. The sendmailCmd wants an MTA, or mail transfer agent, which is essentially a mail server. It's customary for most Unix systems to have such a piece of software which emulates the original Sendmail in its command-line interface, even if that's to send data off the system.

That's why you see a fixed interface here, because whether someone is using Sendmail, Exim, Postfix, or a smarthost-only tool like esmtp-run, whatever software is being used presents the same interface.

It's not likely that we'd add a lot of customizability to this option. However, you can use the same SMTP server that you use with Neomutt by setting the smtpuser, smtpencryption, smtpserver, and smtpserverport options.

You can also use git format-patch --stdout | neomutt -f - and that may provide you the same functionality you were hoping for with sendemail.sendmailCmd.

Signature · 2 lines
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
author
#2 lore raw

Thanks for your quick reply.

Quoted 3 lines

You can also use git format-patch --stdout | neomutt -f - and that may provide you the same functionality you were hoping for with sendemail.sendmailCmd.

It cannot use git send-email -1 I like.

Quoted 2 lines

Mutt and Neomutt are MUAs, which stands for mail user agent. That is, they're mail clients that people use to read, compose, and send email.

People can use MUA to send email, the only problem is -i. I consider the following method

```
[sendemail]
	suppresscc = author
	sendmailCmd = git-neomutt
```

~/.local/bin/neomutt

```
#!/usr/bin/env bash
neomutt "${@//-i/}"
```

And it can work:

```
❯ git send-email -1
/tmp/5441yKUviQ/0001-TEST.patch
The following files are 8bit, but do not declare a Content-Transfer-Encoding.
    /tmp/5441yKUviQ/0001-TEST.patch
Which 8bit encoding should I declare [UTF-8]?
To whom should the emails be sent (if anyone)? my-another@email
Message-ID to be used as In-Reply-To for the first email (if any)?
Logging in...
Warning: Fcc to an IMAP mailbox is not supported in batch mode
Skipping Fcc to imaps://imaphz.qiye.163.com/Sent
OK. Log says:
Sendmail: git-neomutt -i my-another@email
From: Wu Zhenyu <[email protected]>
To: my-another@email
Subject: [PATCH] TEST
Date: Sun,  6 Nov 2022 16:39:49 +0800
Message-Id: <[email protected]>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Result: OK
```

I want to know can we remove -i to allow more MUA/MTA? If user want to add something, why not let them

```
[sendemail]
	sendmailCmd = msmtp -i
```

I think it should be easy to realize.

And I'll consider share this tip to neomutt.

Thanks!

Quoted 32 lines · brian m. carlson
Quoted 8 lines · Wu Zhenyu

Excuse me.

I want to use neomutt as git send-email's cmd:

```
[sendemail]
	sendmailCmd = neomutt
```

Mutt and Neomutt are MUAs, which stands for mail user agent. That is, they're mail clients that people use to read, compose, and send email. The sendmailCmd wants an MTA, or mail transfer agent, which is essentially a mail server. It's customary for most Unix systems to have such a piece of software which emulates the original Sendmail in its command-line interface, even if that's to send data off the system.

That's why you see a fixed interface here, because whether someone is using Sendmail, Exim, Postfix, or a smarthost-only tool like esmtp-run, whatever software is being used presents the same interface.

It's not likely that we'd add a lot of customizability to this option. However, you can use the same SMTP server that you use with Neomutt by setting the smtpuser, smtpencryption, smtpserver, and smtpserverport options.

You can also use git format-patch --stdout | neomutt -f - and that may provide you the same functionality you were hoping for with sendemail.sendmailCmd.

Signature · 2 lines
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Signature · 2 lines
Best Regards
Wu Zhenyu
#4 lore raw
In reply to a message not in the archive
Quoted 1 line · Wu Zhenyu

Thanks for your quick reply.

Hi, please keep the list in CC. It's helpful that everyone can benefit from seeing the replies, and it's possible someone else might have a thought on a good way forward.

Quoted 10 lines
Quoted 3 lines

You can also use git format-patch --stdout | neomutt -f - and that may provide you the same functionality you were hoping for with sendemail.sendmailCmd.

It cannot use git send-email -1 I like.

Quoted 2 lines

Mutt and Neomutt are MUAs, which stands for mail user agent. That is, they're mail clients that people use to read, compose, and send email.

People can use MUA to send email, the only problem is -i. I consider the following method

Sure, I agree that we can do so. In fact, as soon as I'm done composing this email, I'll be using mutt to send that.

Quoted 32 lines
```
[sendemail]
	suppresscc = author
	sendmailCmd = git-neomutt
```

~/.local/bin/neomutt

```
#!/usr/bin/env bash
neomutt "${@//-i/}"
```

And it can work:

```
❯ git send-email -1
/tmp/5441yKUviQ/0001-TEST.patch
The following files are 8bit, but do not declare a Content-Transfer-Encoding.
    /tmp/5441yKUviQ/0001-TEST.patch
Which 8bit encoding should I declare [UTF-8]?
To whom should the emails be sent (if anyone)? my-another@email
Message-ID to be used as In-Reply-To for the first email (if any)?
Logging in...
Warning: Fcc to an IMAP mailbox is not supported in batch mode
Skipping Fcc to imaps://imaphz.qiye.163.com/Sent
OK. Log says:
Sendmail: git-neomutt -i my-another@email
From: Wu Zhenyu <[email protected]>
To: my-another@email
Subject: [PATCH] TEST
Date: Sun,  6 Nov 2022 16:39:49 +0800
Quoted 8 lines
Message-Id: <[email protected]>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Result: OK
```

There's nothing here preventing you from invoking an arbitrary program. That program just has to implement a sendmail-compatible interface, which neomutt doesn't. If you want to wrap neomutt in a sendmail-compatible interface like you've done, then this can work just fine.

Quoted 6 lines

I want to know can we remove -i to allow more MUA/MTA? If user want to add something, why not let them

```
[sendemail]
	sendmailCmd = msmtp -i
```

This breaks a lot of the existing tooling which expects that this is a sendmail-compatible interface. In addition, we might add an additional value in the future, like -B8BITMIME (which we really should be adding if we're sending 8bit data). The documentation specifically says it should be sendmail-like.

Quoted 1 line

I think it should be easy to realize.

I think this is going to cause a bunch of compatibility problems. git send-email is specifically designed to cause email to be sent (i.e., via SMTP). If you want to use another tool to do the sending, that's fine, but then you typically want to use git format-patch to provide those to the other program.

Quoted 3 lines

And I'll consider share this tip to neomutt.

Thanks!

Signature · 2 lines
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
author
#5 lore raw
Quoted 4 lines

That program just has to implement a sendmail-compatible interface, which neomutt doesn't. If you want to wrap neomutt in a sendmail-compatible interface like you've done, then this can work just fine.

Good.
The compatibility is important.
I'll ask neomutt can them provide an official sendmail-compatible interface. Thanks!

Quoted 96 lines · brian m. carlson
Quoted 1 line · Wu Zhenyu

Thanks for your quick reply.

Hi, please keep the list in CC. It's helpful that everyone can benefit from seeing the replies, and it's possible someone else might have a thought on a good way forward.

Quoted 10 lines
Quoted 3 lines

You can also use git format-patch --stdout | neomutt -f - and that may provide you the same functionality you were hoping for with sendemail.sendmailCmd.

It cannot use git send-email -1 I like.

Quoted 2 lines

Mutt and Neomutt are MUAs, which stands for mail user agent. That is, they're mail clients that people use to read, compose, and send email.

People can use MUA to send email, the only problem is -i. I consider the following method

Sure, I agree that we can do so. In fact, as soon as I'm done composing this email, I'll be using mutt to send that.

Quoted 32 lines
```
[sendemail]
	suppresscc = author
	sendmailCmd = git-neomutt
```

~/.local/bin/neomutt

```
#!/usr/bin/env bash
neomutt "${@//-i/}"
```

And it can work:

```
❯ git send-email -1
/tmp/5441yKUviQ/0001-TEST.patch
The following files are 8bit, but do not declare a Content-Transfer-Encoding.
    /tmp/5441yKUviQ/0001-TEST.patch
Which 8bit encoding should I declare [UTF-8]?
To whom should the emails be sent (if anyone)? my-another@email
Message-ID to be used as In-Reply-To for the first email (if any)?
Logging in...
Warning: Fcc to an IMAP mailbox is not supported in batch mode
Skipping Fcc to imaps://imaphz.qiye.163.com/Sent
OK. Log says:
Sendmail: git-neomutt -i my-another@email
From: Wu Zhenyu <[email protected]>
To: my-another@email
Subject: [PATCH] TEST
Date: Sun,  6 Nov 2022 16:39:49 +0800
Quoted 8 lines
Message-Id: <[email protected]>
X-Mailer: git-send-email 2.38.1
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Result: OK
```

There's nothing here preventing you from invoking an arbitrary program. That program just has to implement a sendmail-compatible interface, which neomutt doesn't. If you want to wrap neomutt in a sendmail-compatible interface like you've done, then this can work just fine.

Quoted 6 lines

I want to know can we remove -i to allow more MUA/MTA? If user want to add something, why not let them

```
[sendemail]
	sendmailCmd = msmtp -i
```

This breaks a lot of the existing tooling which expects that this is a sendmail-compatible interface. In addition, we might add an additional value in the future, like -B8BITMIME (which we really should be adding if we're sending 8bit data). The documentation specifically says it should be sendmail-like.

Quoted 1 line

I think it should be easy to realize.

I think this is going to cause a bunch of compatibility problems. git send-email is specifically designed to cause email to be sent (i.e., via SMTP). If you want to use another tool to do the sending, that's fine, but then you typically want to use git format-patch to provide those to the other program.

Quoted 3 lines

And I'll consider share this tip to neomutt.

Thanks!

Signature · 2 lines
brian m. carlson (he/him or they/them)
Toronto, Ontario, CA
Signature · 2 lines
Best Regards
Wu Zhenyu