I''m writing this message in mutt instead of sup because I send my email via a postfix relay-host and mutt allows me to set my Return-Path equal to my "From:" address with "set envelope_from=yes". If I don''t do this, my email is often rejected from mailing lists. I believe other email clients default to this behavior (see http://www.mail-archive.com/mutt-users at mutt.org/msg26743.html for the post I''m basing my assumption on). Could sup follow that, or at least allow the option? I imagine the fix for this would go in edit-message-mode.rb, but my ruby skills aren''t quite there yet. gsf (a pythonista, mostly)
Reformatted excerpts from Gabriel Sean Farrell''s message of 2008-01-23:> I''m writing this message in mutt instead of sup because I send my > email via a postfix relay-host and mutt allows me to set my > Return-Path equal to my "From:" address with "set envelope_from=yes". > If I don''t do this, my email is often rejected from mailing lists. > > I believe other email clients default to this behavior (see > http://www.mail-archive.com/mutt-users at mutt.org/msg26743.html for the > post I''m basing my assumption on). Could sup follow that, or at least > allow the option?The Sup way to do this is to have the following line in your ~/.sup/hooks/before-edit.rb: header["Return-Path"] = header["From"] Unfortunately, you have to apply the following patch or Sup simply discards that header. There''s a better solution, which is to make Sup not discard any headers set by the user when composing email, and I will take it as a bugfix task to implement that for the next release. diff --git a/lib/sup/mbox.rb b/lib/sup/mbox.rb index 0ce52fe..55dd44f 100644 --- a/lib/sup/mbox.rb +++ b/lib/sup/mbox.rb @@ -32,6 +32,7 @@ module MBox /^(List-Post):\s+(.*?)\s*$/i, /^(List-Subscribe):\s+(.*?)\s*$/i, /^(List-Unsubscribe):\s+(.*?)\s*$/i, + /^(Return-Path):\s+(.*?)\s*$/i, /^(Status):\s+(.*?)\s*$/i: header[last = $1] = $2 when /^(Message-Id):\s+(.*?)\s*$/i: header[mid_field = last = $1] = $2 -- William <wmorgan-sup at masanjin.net>
On Wed, Jan 23, 2008 at 02:12:07PM -0800, William Morgan wrote:> Reformatted excerpts from Gabriel Sean Farrell''s message of 2008-01-23: > > I''m writing this message in mutt instead of sup because I send my > > email via a postfix relay-host and mutt allows me to set my > > Return-Path equal to my "From:" address with "set envelope_from=yes". > > If I don''t do this, my email is often rejected from mailing lists. > > > > I believe other email clients default to this behavior (see > > http://www.mail-archive.com/mutt-users at mutt.org/msg26743.html for the > > post I''m basing my assumption on). Could sup follow that, or at least > > allow the option? > > The Sup way to do this is to have the following line in your > ~/.sup/hooks/before-edit.rb: > header["Return-Path"] = header["From"] > > Unfortunately, you have to apply the following patch or Sup simply > discards that header. There''s a better solution, which is to make Sup > not discard any headers set by the user when composing email, and I will > take it as a bugfix task to implement that for the next release. > > diff --git a/lib/sup/mbox.rb b/lib/sup/mbox.rb > index 0ce52fe..55dd44f 100644 > --- a/lib/sup/mbox.rb > +++ b/lib/sup/mbox.rb > @@ -32,6 +32,7 @@ module MBox > /^(List-Post):\s+(.*?)\s*$/i, > /^(List-Subscribe):\s+(.*?)\s*$/i, > /^(List-Unsubscribe):\s+(.*?)\s*$/i, > + /^(Return-Path):\s+(.*?)\s*$/i, > /^(Status):\s+(.*?)\s*$/i: header[last = $1] = $2 > when /^(Message-Id):\s+(.*?)\s*$/i: header[mid_field = last = $1] = $2I''ve added the line and applied the patch. Now I see "Return-Path" in the headers of my message before I send it, but when I receive it the return-path is still the one I was trying to override. Could the one I set still be getting stripped out?
Reformatted excerpts from Gabriel Sean Farrell''s message of 2008-01-23:> I''ve added the line and applied the patch. Now I see "Return-Path" in > the headers of my message before I send it, but when I receive it the > return-path is still the one I was trying to override. Could the one > I set still be getting stripped out?I don''t think so... you can apply the patch below and see exactly what Sup is sending sendmail. In my case, that header is intact. So it must be getting overwritten somewhere else in the system. There''s some crazy interaction between this header, the From: and Sender: headers, and the -f option of sendmail. Maybe you should use a -f with sendmail (in your ~/.sup/config.yaml file)? Did you have a particular way of calling sendmail with Mutt? diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mod index 6a7f273..0e50724 100644 --- a/lib/sup/modes/edit-message-mode.rb +++ b/lib/sup/modes/edit-message-mode.rb @@ -279,6 +279,7 @@ protected date = Time.now m = build_message date IO.popen(acct.sendmail, "w") { |p| p.puts m } + File.open("sent-copy.txt", "w") { |f| f.puts m } raise SendmailCommandFailed, "Couldn''t execute #{acct.sendmail}" unless $ SentManager.write_sent_message(date, from_email) { |f| f.puts sanitize_bo BufferManager.kill_buffer buffer -- William <wmorgan-sup at masanjin.net>
Excerpts from William Morgan''s message of Thu Jan 24 23:03:58 -0500 2008:> I don''t think so... you can apply the patch below and see exactly what > Sup is sending sendmail. In my case, that header is intact. So it must > be getting overwritten somewhere else in the system. > > There''s some crazy interaction between this header, the From: and > Sender: headers, and the -f option of sendmail. Maybe you should use a > -f with sendmail (in your ~/.sup/config.yaml file)? Did you have a > particular way of calling sendmail with Mutt?Right you are about the crazy interaction. It''s not clear to me how Mutt is calling sendmail, but now I''m guessing all that the "set envelope_from=yes" does in mutt is add the -f flag followed by one''s "from" email to the call to sendmail. If I do that in my ~/.sup/config.yaml, the return-path is set correctly (at least, it was in my tests. How does this message look?!). In fact, I believe it''s set correctly even if I don''t set the return-path in ~/.sup/hooks/edit-before.rb or patch lib/mbox.rb. In other words, all that needs to be done to fix my problem is the addition of -f <email> to the sendmail call. Maybe it could be an option in the initial account setup? Oh, and thanks for all the work you''re doing on sup, William. Really great stuff.
On 25.1.2008, Gabriel Sean Farrell wrote:> In other words, all that needs to be done to fix my problem is the > addition of -f <email> to the sendmail call. Maybe it could be an > option in the initial account setup?Even better if this string could written with the to send email as a variable so you could write something like "sendmail -f #{m.from}" ... or somehting like that. Marcus