On Fri, Sep 12, 2003 at 09:16:14AM -0400, Jeff Elkins wrote:
> She who must be obeyed asked me to generate a list of family
> birthdays, so I whipped up a perl script to read a flat file at the
> beginning of each month and report via mail on who's up... However, it
> seems that my exim.conf is not up to snuff. When I enter proper
> addresses into my script (i.e. [EMAIL PROTECTED]) delivery
> fails with a munged address of: [EMAIL PROTECTED] --- It works
> if addresses in the perl script are left unqualified, pointing to
> local accounts -- jeff works [EMAIL PROTECTED] fails. Mail seems to work
> fine otherwise. 
> 
> Where might I have screwed up?
> 
> #!/usr/bin/perl
> 
> open(MAIL,"|exim -bm -f jeff -t");
> print MAIL "To: [EMAIL PROTECTED]";
> print MAIL "From: [EMAIL PROTECTED]";
> print MAIL "CC: [EMAIL PROTECTED]";

Change "@" to "\@" throughout. Double-quotes trigger interpolation of
variables in their contents, including array variables like @elkins and
@earthlink. If you use the -w switch and 'use strict;', perl will tell
you about such mistakes.

> print MAIL "Subject: Birthdays\n";
> print MAIL "X-Generated-By: bday\n";
> 
> print MAIL "Upcoming Birthdays\n";
> print MAIL "==================\n";

Also, you might find this easier:

  print MAIL <<'EOF';
  To: [EMAIL PROTECTED]
  From: [EMAIL PROTECTED]
  CC: [EMAIL PROTECTED]
  Subject: Birthdays
  X-Generated-By: bday

  Upcoming Birthdays
  ==================
  EOF

(Be careful to remove the indenting I've used. The EOF *must* occur at
the very beginning of a line.)

The here-document syntax avoids all the repetitive 'print MAIL' bits,
and single-quoting the 'EOF' means that all the text is implicitly
single-quoted, which in turn means that no variable interpolation
happens, so you don't have to turn '@' into '\@' here.

Cheers,

-- 
Colin Watson                                  [EMAIL PROTECTED]


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to