Rock. This works like a charm. Thanks a lot.

-----Original Message-----
From: Mark Delany [mailto:[EMAIL PROTECTED]]
Sent: Thursday, May 17, 2001 2:17 PM
To: [EMAIL PROTECTED]
Subject: Re: qmail ignores my sorry ass part II...


On Thu, May 17, 2001 at 01:57:11PM -0700, Brett wrote:
> Here's how I'm calling qmail-inject:
>
>
>         $mail_prog = '/var/qmail/bin/qmail-inject';
>
>         $mail =  "To: $to_name <$to_email>\r\n";
>         $mail .= "From: $from_name <$from_email>\r\n";
>         if ($bcc) {
>                 $mail .= "Bcc: $bcc \r\n";
>         }
>         $mail .= "Subject: $subject\r\n\r\n";
>         $mail .= "$body\r\n";
>
>         system ("echo '$mail' | $mail_prog");
>
> The Bccs are in the header but they're still being inserted into the
command
> line which is what I meant by "more or less". I actually don't really see
> another way of getting all the bccs to qmail-inject.

Ahh. You've got them on echo's command line. I've never quite seen it
done that way before...

There are *much* better ways that avoid such limits. Try this:


OPEN(MP, "| $mail_prog") or die ...

print MP "To: $to_name <$to_email>\r\n";
print MP "From: $from_name <$from_email>\r\n";

if ($bcc) {
        print MP "Bcc: $bcc \r\n";
}

print MP "Subject: $subject\r\n\r\n";
print MP "$body\r\n";

close(MP) or die ...;


No command line limit, no echo, no lumpy $mail variable. I'd also be
inclined to print a separate Bcc: header for each recipient, but
that's just my "must always scale" mentality.


Hmm. It must be "unix/perl day" on the qmail list.


Regards.

Reply via email to