I have not been on the mutt lists for some time but I heard from Magnus
Bodin that there has been some discussion of mutt vs. qmail-inject. The
trouble is that mutt quotes the addresses (RFC821) for sendmail but qmail
expects them unquoted. A couple of years ago I sent the attached code to the
mutt-dev list. It's a little wrapper between mutt and qmail-inject which
removes the quoting before giving the address to qmail-inject.

set sendmail='/usr/local/sbin/muttqmail'

where muttqmail compiles from the attached code
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>

void nomem()
{
   printf("muttqmail: out of memory\n");
   exit(111);
}

void removequote (char *d, char *s)
{
   char c;
   do
     {
        c = *s++;
        if (c != '\"')
          {
             if (c == '\\')
               c = *s++;
             *d++ = c;
          }
     }
   while (c != '\0');
}

void main(int argc,char **argv)
{
   char **newargv;
   char **arg;
   int i;
   
   newargv = (char **) malloc((argc + 1) * sizeof(char *));
   if (!newargv) nomem();
   arg = newargv;
   *arg++ = "/var/qmail/bin/qmail-inject";
   for (i = 1;i < argc;++i)
     {
        *arg=malloc((strlen(argv[i])+1)*sizeof(char));
        if (!*arg) nomem();
        removequote(*arg,argv[i]);
        arg++;
     }
   *arg = NULL;
   execv(*newargv,newargv);
   printf("muttqmail: unable to run qmail-inject\n");
   exit(111);
}

Reply via email to