On Mon, Jul 10, 2000 at 03:51:50PM +0200, Magnus Bodin wrote:
> 
> I use qmail-inject as my mutt mail queuing agent as this:
> in my .muttrc: 
> set sendmail = '/var/qmail/bin/qmail-inject -f [EMAIL PROTECTED]'

I use this:

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

where muttqmail is compiled from the attached c source.
#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