Re: Mailing from script

2001-04-04 Thread David Young

>> And NO, you're not trying to pass the recip on the command line. Your're
>> passing it on STDIN.
>> 
> 
> I still don't understand your logic here -- script.pl [EMAIL PROTECTED] sent
> mail to [EMAIL PROTECTED] -- but that's not really relevant to this list, so
> don't worry about it.

You are talking about different things... Alex, you may well be passing the
address INTO YOUR SCRIPT on the command line. Johan and Bruce are pointing
out that _within_ your script you are not passing the address TO SENDMAIL on
the command line.

# pass to sendmail on commands line
open MAIL, "|/usr/lib/sendmail -t $recip" ...

# passing on STDIN
open (MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: $recip\n";





Re: Mailing from script

2001-04-04 Thread Henning Brauer

On Wed, Apr 04, 2001 at 07:44:00PM +, Alex Le Fevre wrote:
> > No it isn't. The =~ s stuff is totally unnecessary, as you're not passing
> > the address on the command line to sendmail... 
> 
> Maybe I didn't make myself clear. I *am* trying to pass the e-mail address 
> from the command line to sendmail. And yes, $recip *is* user\@domain.com -- 
> I printed it to STDOUT, and it showed up just like that. 

Alex, it must not be user\@domain, it must print as user@domain. This is a
perl question and qmail, though.

> IMHO, if the script works fine when I have a hard-coded To: line, and my 
> $recip comes out a replica of my hard-coded To: line, it doesn't seem to me 
> to be a Perl problem. 

The error sits in between keyboard and chair ;-))


-- 
Henning Brauer | BS Web Services
Hostmaster BSWS| Roedingsmarkt 14
[EMAIL PROTECTED] | 20459 Hamburg
http://www.bsws.de | Germany



Re: Mailing from script

2001-04-04 Thread Alex Le Fevre

> Aw come on, take away the =~ s line and you'll be fine. I promise.

::Looks chagrined:: Hmm. You were right. I just know that I need the "\" 
before the "@" when I hard-code, so I thought it would be necessary with my 
variable as well. 

> And NO, you're not trying to pass the recip on the command line. Your're
> passing it on STDIN. 
> 

I still don't understand your logic here -- script.pl [EMAIL PROTECTED] sent 
mail to [EMAIL PROTECTED] -- but that's not really relevant to this list, so 
don't worry about it. 

Alex



Re: Mailing from script

2001-04-04 Thread Peter Green

* Alex Le Fevre <[EMAIL PROTECTED]> [010404 15:53]:
> > No it isn't. The =~ s stuff is totally unnecessary, as you're not passing
> > the address on the command line to sendmail... 
> 
> Maybe I didn't make myself clear. I *am* trying to pass the e-mail address 
> from the command line to sendmail. And yes, $recip *is* user\@domain.com -- 
> I printed it to STDOUT, and it showed up just like that. 

You are NOT passing the e-mail address on the command line with sendmail. If
you were, your open() line would look more like:

  open MAIL, "|/usr/lib/sendmail -t $recip" ...

But it doesn't.

> IMHO, if the script works fine when I have a hard-coded To: line, and my 
> $recip comes out a replica of my hard-coded To: line, it doesn't seem to me 
> to be a Perl problem. 

Why are you escaping the '@' with: s/\@/\\\@/ ?  There's no reason for it
whatsoever.

/pg
-- 
Peter Green : Gospel Communications Network, SysAdmin : [EMAIL PROTECTED]
---
Dad always thought laughter was the best medicine, which I guess is why 
several of us died of tuberculosis.
 (Jack Handey)




Re: Mailing from script

2001-04-04 Thread Johan Almqvist

* Alex Le Fevre <[EMAIL PROTECTED]> [010404 21:44]:
> > No it isn't. The =~ s stuff is totally unnecessary, as you're not passing
> > the address on the command line to sendmail... 
> Maybe I didn't make myself clear. I *am* trying to pass the e-mail address 
> from the command line to sendmail. And yes, $recip *is* user\@domain.com -- 
> I printed it to STDOUT, and it showed up just like that. 

Aw come on, take away the =~ s line and you'll be fine. I promise.

And NO, you're not trying to pass the recip on the command line. Your're
passing it on STDIN.

> IMHO, if the script works fine when I have a hard-coded To: line, and my 
> $recip comes out a replica of my hard-coded To: line, it doesn't seem to me 
> to be a Perl problem. 

...

-Johan
-- 
Johan Almqvist
http://www.almqvist.net/johan/qmail/

 PGP signature


Re: Mailing from script

2001-04-04 Thread Alex Le Fevre

> No it isn't. The =~ s stuff is totally unnecessary, as you're not passing
> the address on the command line to sendmail... 

Maybe I didn't make myself clear. I *am* trying to pass the e-mail address 
from the command line to sendmail. And yes, $recip *is* user\@domain.com -- 
I printed it to STDOUT, and it showed up just like that. 

IMHO, if the script works fine when I have a hard-coded To: line, and my 
$recip comes out a replica of my hard-coded To: line, it doesn't seem to me 
to be a Perl problem. 

Alex



Re: Mailing from script

2001-04-04 Thread Johan Almqvist

* Alex Le Fevre <[EMAIL PROTECTED]> [010404 21:16]:
> The relevant part of the script appears below: 

Speaking of relevancy, this is pretty irrellevant to this list. You made a
perl mistake.

> $recip = $ARGV[0];
> $recip =~ s/\@/\\\@/g;
> print $recip;
> open (MAIL, "|/usr/sbin/sendmail -t");
> print MAIL "To: $recip\n";
> print MAIL "From: quoteoftheday\@schnarff.com\n";
> print MAIL "Reply-to: alex\@schnarff.com\n";
> print MAIL "Subject: Quote for $date\n";
> print MAIL $sdata[rand(@sdata)];
> close MAIL; 
> 
> $recip, when I printed it to the screen for testing purposes, came out as 
> user\@domain.com, which is exactly what I need. 

No it isn't. The =~ s stuff is totally unnecessary, as you're not passing
the address on the command line to sendmail... Take out that line and
qmail will stop appending the domain...

> Any idea why the mailwrapper would append my local domain like that? 

Because it couldn't find a domain.

-Johan
-- 
Johan Almqvist
http://www.almqvist.net/johan/qmail/

 PGP signature


Mailing from script

2001-04-04 Thread Alex Le Fevre

I just wrote a Perl script that gets an e-mail address from the command line 
and then subs it in as the To: field in mailwrapper output. While the 
program worked just fine when I manually entered the To: field, it appends 
@www.schnarff.com to that field when I get it from the command line.

The relevant part of the script appears below: 

$recip = $ARGV[0];
$recip =~ s/\@/\\\@/g;
print $recip;
open (MAIL, "|/usr/sbin/sendmail -t");
print MAIL "To: $recip\n";
print MAIL "From: quoteoftheday\@schnarff.com\n";
print MAIL "Reply-to: alex\@schnarff.com\n";
print MAIL "Subject: Quote for $date\n";
print MAIL $sdata[rand(@sdata)];
close MAIL; 

$recip, when I printed it to the screen for testing purposes, came out as 
user\@domain.com, which is exactly what I need. 

Any idea why the mailwrapper would append my local domain like that? 

Thanks,
Alex Le Fevre