Using send and reply hooks to set from address and reverse_name

2013-05-02 Thread Suvayu Ali
Hi Mutt users,

I have been having some problems setting my from address when I'm
responding to my emails in a thread.  I have $reverse_name set to yes
and have posted about this before[1].  Since then I have realised my
problem arises from conflicting hooks and I can't think of a way to
resolve the issue.

I send emails from multiple addresses: personal, mailing lists, work1,
and work2.  So I have a series of send hooks like these:

  send-hook "%C work1" my_hdr From: m...@work1.com
  send-hook "%C work2" my_hdr From: m...@work2.com
  send-hook "%C lists" my_hdr From: li...@gmail.com

Note that I do not have any default send-hook set.  I also have the
following reply-hooks so that I can automatically reply with the correct
from address based on which account the email was delivered to.

  reply-hook . my_hdr From: perso...@gmail.com
  reply-hook '~h "Delivered-To: +list@gmail\.com"' my_hdr From: "l...@gmail.com"
  reply-hook '~h "Delivered-To: +me@work1\.com"' my_hdr From: m...@work1.com
  reply-hook '~h "Delivered-To: +me@work2\.com"' my_hdr From: m...@work2.com

Now my problem is the default reply-hook above overrides the from
address set by reverse_name=yes.  If I comment it out, then the from
address is what was set by the last "my_hdr From: ..." command in the
above hooks.  I want it to be my personal address.

Any ideas how to resolve this conflict between hooks and reverse_name?

Thanks in advance for any hints/pointers.

Cheers,


Footnotes:

[1] 


-- 
Suvayu

Open source is the future. It sets us free.


CLI assistance please

2013-05-02 Thread Richard Bown
Hi ,
I'm new to mutt , so daft questions
Application
Headless computer running motion , msmtp
At the moment I'm using mailx to send mail to me to notify me of movement 
detection,
I've tried to send a copy of the MPEG4 .avi as an attachment , and it justs 
sends 7676 bytes
everytime.
So , Mutt.
It will never receive , only send smtp so the muttrc file can be simplified, 
this is where I need
help, as all the example scripts are for normal use. I have symlinks in already 
from  sbin/sendmail
to sbin/msmtp
my mailrc file just has one line 
set sendmail="/usr/bin/msmtp"

What do I need to put in the muttrc file to do the same, allowing for 
attachments to be mpeg4  ~?
The current mail command in the motion.conf file is:-

on_movie_start echo ["Camera detection" %d/%m/%Y  %H:%M:%S--%v] |mailx -s 
"Movement Detected
%d/%m/%Y  %H:%M:%S" -a  /Files/motion-pics/%d-%m-%Y_%H:%M-%v.avi 
rich...@g8jvm.info

That all on one line, 

Many thanks

-- 
-- 
Best wishes / 73
Richard Bown

Email : rich...@g8jvm.info
HTTP  :http://www.g8jvm.info
nil carborundum a illegitemis
##
Ham Call G8JVM . OS Fedora FC18 x86_64 on a Dell Inspiron N5030 laptop
Maidenhead QRA: IO82SP38, LAT. 52 39.720' N LONG. 2 28.171 W ( degs+mins )
QRV VHF 6mtrs 200W, 4 mtrs 150W, 2mtrs 350W, 70cms 200W
Microwave 23 cms 140W, 13 cms 100W, 6 cms 0W & 3cms 5W
##
 
Please do not use the e-mail address of rich...@g8jvm.com
Mail hosted by 1and1, Domain screwed up by 1and1 and Freeparking


Re: Using send and reply hooks to set from address and reverse_name

2013-05-02 Thread Patrick Shanahan
* Suvayu Ali  [05-02-13 04:31]:
 [...]
> Note that I do not have any default send-hook set.  I also have the
> following reply-hooks so that I can automatically reply with the correct
> from address based on which account the email was delivered to.
> 
>   reply-hook . my_hdr From: perso...@gmail.com
>   reply-hook '~h "Delivered-To: +list@gmail\.com"' my_hdr From: 
> "l...@gmail.com"
>   reply-hook '~h "Delivered-To: +me@work1\.com"' my_hdr From: m...@work1.com
>   reply-hook '~h "Delivered-To: +me@work2\.com"' my_hdr From: m...@work2.com
> 
> Now my problem is the default reply-hook above overrides the from
> address set by reverse_name=yes.  If I comment it out, then the from
> address is what was set by the last "my_hdr From: ..." command in the
> above hooks.  I want it to be my personal address.
> 
> Any ideas how to resolve this conflict between hooks and reverse_name?

Reading "man muttrc" reply-hook discussion might help you.  It explains
the usage:
   reply-hook [!]pattern command
   When replying to a message matching pattern, command is executed. 
   When multiple reply-hooks match, they are executed in the order in
   which they occur in the configuration file, but all reply-hooks are
   matched and executed before send-hooks, regardless of their order
   in the configuration file.

Note that *all* matching reply hooks are "matched and executed before
send-hooks, reguardless ...", and you can have *only* one From: address. 
I would guess that in your case the From: address selection is somewhat
arbitrary from the conditions you set and settless to your default. 
   

I would suggest using "send-hook", and set a default, to accomplish your
desires.  Further reading of the mutt and muttrc man pages will help.


-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  HOG # US1244711
http://wahoo.no-ip.orgPhoto Album: http://wahoo.no-ip.org/gallery2
http://en.opensuse.org   openSUSE Community Member
Registered Linux User #207535@ http://linuxcounter.net


Re: CLI assistance please

2013-05-02 Thread Patrick Shanahan
* Richard Bown  [05-02-13 04:45]:
 [...]
> Headless computer running motion , msmtp
> At the moment I'm using mailx to send mail to me to notify me of movement 
> detection,
> I've tried to send a copy of the MPEG4 .avi as an attachment , and it justs 
> sends 7676 bytes
> everytime.
> So , Mutt.
> It will never receive , only send smtp so the muttrc file can be simplified, 
> this is where I need
> help, as all the example scripts are for normal use. I have symlinks in 
> already from  sbin/sendmail
> to sbin/msmtp
> my mailrc file just has one line 
> set sendmail="/usr/bin/msmtp"
> 
> What do I need to put in the muttrc file to do the same, allowing for 
> attachments to be mpeg4  ~?
> The current mail command in the motion.conf file is:-

have you considered setting "sendmail" in the muttrc?
-- 
(paka)Patrick Shanahan   Plainfield, Indiana, USA  HOG # US1244711
http://wahoo.no-ip.orgPhoto Album: http://wahoo.no-ip.org/gallery2
http://en.opensuse.org   openSUSE Community Member
Registered Linux User #207535@ http://linuxcounter.net


Re: CLI assistance please

2013-05-02 Thread Tom Furie
On Thu, May 02, 2013 at 09:42:46AM +0100, Richard Bown wrote:

> What do I need to put in the muttrc file to do the same, allowing for 
> attachments to be mpeg4  ~?
> The current mail command in the motion.conf file is:-
> 
> on_movie_start echo ["Camera detection" %d/%m/%Y  %H:%M:%S--%v] |mailx -s 
> "Movement Detected
> %d/%m/%Y  %H:%M:%S" -a  /Files/motion-pics/%d-%m-%Y_%H:%M-%v.avi 
> rich...@g8jvm.info

You shouldn't need to put anything specific in your .muttrc file. Simply
changing the mailx command in motion.conf to a mutt command should be
sufficient.

Cheers,
Tom

-- 
I just heard the SEVENTIES were over!!  And I was just getting in touch
with my LEISURE SUIT!!


signature.asc
Description: Digital signature


Re: CLI assistance please

2013-05-02 Thread Richard Bown
On Thu, 2 May 2013 14:24:46 +0100
Tom Furie  wrote:

> On Thu, May 02, 2013 at 09:42:46AM +0100, Richard Bown wrote:
> 
> > What do I need to put in the muttrc file to do the same, allowing for 
> > attachments to be mpeg4
> > ~? The current mail command in the motion.conf file is:-
> > 
> > on_movie_start echo ["Camera detection" %d/%m/%Y  %H:%M:%S--%v] |mailx -s 
> > "Movement Detected
> > %d/%m/%Y  %H:%M:%S" -a  /Files/motion-pics/%d-%m-%Y_%H:%M-%v.avi 
> > rich...@g8jvm.info
> 
> You shouldn't need to put anything specific in your .muttrc file. Simply
> changing the mailx command in motion.conf to a mutt command should be
> sufficient.
> 
> Cheers,
> Tom
> 

OK Thanks

-- 
-- 
Best wishes / 73
Richard Bown

Email : rich...@g8jvm.info
HTTP  :http://www.g8jvm.info
nil carborundum a illegitemis
##
Ham Call G8JVM . OS Fedora FC18 x86_64 on a Dell Inspiron N5030 laptop
Maidenhead QRA: IO82SP38, LAT. 52 39.720' N LONG. 2 28.171 W ( degs+mins )
QRV VHF 6mtrs 200W, 4 mtrs 150W, 2mtrs 350W, 70cms 200W
Microwave 23 cms 140W, 13 cms 100W, 6 cms 0W & 3cms 5W
##
 
Please do not use the e-mail address of rich...@g8jvm.com
Mail hosted by 1and1, Domain screwed up by 1and1 and Freeparking


Re: mutt tries to auto_view all old messages

2013-05-02 Thread Ulrich Lauther
On Mon, Apr 29, 2013 at 08:30:49AM +1000, Cameron Simpson wrote:
> On 28Apr2013 23:34, Ulrich Lauther  wrote:
> | I upgraded to ubuntu 12.04 which implies mutt 1.5.21
> | Now, when I do
> | mutt -f mbox
> | where mbox contains all my old, already read, messages,
> | mutt tries to open a firefox tab for each message containing html.
> | (I have
> | auto_view text/html in .muttrc
> | and 
> | text/html; firefox_elinks %s; needsterminal; copiousoutput;
> | in .mailcap
> | )
> | 
> | I tried to fiddle with mail_check_recent, to no avail.
> | 
> | Compiling and installing 1.4.2.3 fixed the problem, but is there 
> | a configuration option in 1.5.21 to avoid this strange behaviour?
> 
> I would expect it to be the copiusoutput string.
> 
> copiousoutput is used to choose the decoder used to render html as
> plain text for viewing in mutt's pager.
> 
> The line without "copiousoutput" (not that you have one) would be
> the one to open some HTML in a broswer (for example).
> 
> My html mailcap lines go:
> 
>   text/html; env DISPLAY= unhtml %s | less
>   text/html; exec 2>&1 && env DISPLAY= unhtml %s; copiousoutput
> 
> The copiousoutput one runs "unhtml", a little wrapper script I have
> here that uses w3m and a couple of other things to transcribe HTML
> as text.
> 
> The non-copious output one is for viewing HTML in the "attachements"
> menu, where one might reasonably pop the text up in a browser or
> something. You can see I just render it as text and page it with
> "less".
> 
> Try removing "copiousoutput" from you mailcap line and see if the
> behaviour changes.
> 
> I would point it that it is not just viewing messages that will
> trigger this. And message search you do that needs to search the
> message body will fire the mailcap line as well.
> 
> Cheers,
> -- 
> Cameron Simpson 
> 
> Our friend Trefayne is really most intuitive; you may trust that anything he
> says is absolutely true.- Aylebourne

Removing "copiousoutput" avoids opening all messages in the browser, but
then I see NO message there.
The behaviour I need and have with 1.4.2.3 is at follows:

with mutt -f mbox

I get a view into mbox, one line per mail.
If I select one of these lines, the message is displayed.
If this message contains HTML, it is displayed in plain ascii
(via "text/html; firefox_elinks %s; needsterminal; copiousoutput; ")

where firefox_elinks contains:

  elinks -dump -default-mime-type text/html $1
  firefox $1 
  exit 0

AND it is displayed in the browser window (due to the 2nd line of the script).

How can I get the same behaviour with 1.5.21?

Kind regards,

 ulrich