>
> Hmmm...consider your code stolen. Thanks. :->
That's what makes the 'net go round. I modified it from someone's
sendmail example ;-)
Thanks for your example - the putenv("QMAILHOST=$host"); sets
$QMAILHOST for use by PHP as an environment variable within
that script's execution space, but doesn't share it with qmail. qmail
only gets the data that we specifically pipe to it. The
fputs($fp,"QMAILHOST: $host\n"); code line seems to be treated
as an unknown informational header by qmail-inject, it leaves it
completely intact, but does not recognize it as the QMAILHOST
environment variable.
Any other ideas?
Thanks, J!M
>
> >
> > The qmail-inject man page indicates that the -f flag overrides Return-
> > Path, and From, if they are supplied. It also states that I can set
> > QMAILHOST to accomplish the same thing... forgive me if this is an
> > extra-stupid question, but I've been RTFM and I still have no idea what
> > the syntax or method would be to do this.
>
> I used to do this when I was using ELM to send mail from a virtual
> host.
> you set the QMAILHOST environment variable to the virtual domain-name, and
> QMAILUSER to the name of the virual user. Like this:
>
> $to = "person@company";
> $subject = "host piped email message";
> $message = "here is the message body\n$email";
> $user="info";
> $host="margecares.com";
> $from = "$user@$host";
> putenv("QMAILHOST=$host");
> putenv("QMAILUSER=$user");
>
> $fp = popen('/var/qmail/bin/qmail-inject', "w");
> fputs($fp,"To: $to\n");
> fputs($fp,"QMAILHOST: $host\n");
> fputs($fp,"From: $email\n");
> fputs($fp,"Subject: $subject\n\n");
> fputs($fp,$message);
> fputs($fp,"\n");
> pclose($fp);
>
> I've never used the -f flag for qmail-inject, nor played with popen()
> much, so I don't know why that wasn't working for you. The code above
> should do what you want, though.
>
>
> > Any examples or suggestions appreciated.
> > J!M
> >
> --
>
> "If I should take a notion to jump into the ocean
> Tain't nobody's bizness if I do"
> -- Billie Holiday
>
> GnuPG key available at http://devel.duluoz.net/pubkey.asc
> Key ID = 1024D/9A256AE5 1999-11-13 Mike Glover <[EMAIL PROTECTED]>
> Key fingerprint = EF6E 8BCB 4810 E98C F0FD 4596 367A 32B7 9A25 6AE5
>
>
>
>