writing to a mail file handle and PERL
Hello, I currently have a script written in PERL which contains the lines: $mailprog = "/usr/lib/sendmail"; open(MAIL, "|$mailprog -t"); print MAIL "To: $email\n"; print MAIL "From: $from\n"; #print MAIL "Cc: $boss\n"; print MAIL "Subject:$subject\n"; print MAIL "MIME-Version: 1.0\n"; print MAIL "Content-Type: text\/html\; charset\=us-ascii\; name=\"newsl.html\"\n "; print MAIL "Content-Transfer-Encoding: 7bit\n"; The script sends the mail out OK but ends up being returned with the following error message: Hi. This is the qmail-send program at ketel-1.raremedium.com. I'm afraid I wasn't able to deliver your message to the following addresses. This is a permanent error; I've given up. Sorry it didn't work out. <[EMAIL PROTECTED]@ketel-1.raremedium.com>: Sorry, no mailbox here by that name. (#5.1.1) and To: [EMAIL PROTECTED]@ketel-1.raremedium.com For some reason qmail is appending the the sending machines's domain name onto the original recipient, even though I am calling sendmail directly. I am confused by this. I notice that under /usr/local/var/qmail/bin there is an executable called sendmail. If I want to open up a handle for my PERL script should I be using $mailprog = "/usr/local/var/qmail/bin/sendmail" ? Or is there a way to open up a file handle to qmail directly from my script and then just print to that file handle. Any help would be greatly appreciated. It seems that although qmail is installed if I tried to call the sendmail program, Qmail seems to intercept it somehow. At least that is what I am guessing as to why when the $email variable in my script contains [EMAIL PROTECTED] it results in being parsed and having @ketel-1.raremedium.com appended to it. Anyway thanks in advance. Clifford Clifford Thurber Web Systems Administrator LiveUniverse.com [EMAIL PROTECTED] 565 5th Ave. 29th Fl. New York, NY 10017 Ph:212 883 6940 (131) Fax:212 856 9134
Re: writing to a mail file handle and PERL
clifford thurber <[EMAIL PROTECTED]> wrote: >Hello, >I currently have a script written in PERL which contains the lines: > >$mailprog = "/usr/lib/sendmail"; > >open(MAIL, "|$mailprog -t"); Try: $mailprog = "/usr/local/var/qmail/qmail-inject"; open(MAIL, "|$mailprog"); >The script sends the mail out OK but ends up being returned with the >following error message: >Hi. This is the qmail-send program at ketel-1.raremedium.com. >I'm afraid I wasn't able to deliver your message to the following addresses. >This is a permanent error; I've given up. Sorry it didn't work out. ><[EMAIL PROTECTED]@ketel-1.raremedium.com>: >Sorry, no mailbox here by that name. (#5.1.1) That doesn't look "OK" to me. >For some reason qmail is appending the the sending machines's domain name >onto the original recipient, even though I am calling sendmail directly. I >am confused by this. Me too. It shouldn't append a host unless one wasn't supplied. >I notice that under /usr/local/var/qmail/bin there is >an executable called sendmail. If I want to open up a handle for my PERL >script should I be using $mailprog = "/usr/local/var/qmail/bin/sendmail" >? Or is there a way to open up a file handle to qmail directly from my >script and then just print to that file handle. Any help would be greatly >appreciated. See above. qmail's "sendmail" is just a wrapper for qmail-inject, which you should call directly. >It seems that although qmail is installed if I tried to call the sendmail >program, Qmail seems to intercept it somehow. If you installed qmail according to the directions, you replaced /usr/lib/sendmail with a link to qmail's "sendmail". That's how it's "intercepting" your message. -Dave