[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: exim.conf screwed up?



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. jeffelkins@earthlink.net) delivery
> fails with a munged address of: jeffelkins.net@elkins.org --- It works
> if addresses in the perl script are left unqualified, pointing to
> local accounts -- jeff works jeff@elkins.org 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: jeff@elkins.org\n";
> print MAIL "From: jeff@elkins.org\n";
> print MAIL "CC: jeffelkins@earthlink.net\n";

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: jeff@elkins.org
  From: jeff@elkins.org
  CC: jeffelkins@earthlink.net
  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                                  [cjwatson@flatline.org.uk]



Reply to: