AlphalphaMale has asked for the wisdom of the Perl Monks concerning the following question:
OK I use the Sendmail module quite a lot and normally have no issues with it, but this time I'm trying to read in the "To" entries from an external file and use them from a variable but it's giving me issues. Sendmail normally expects to see something like this:
%newmsg = ( From => 'whoever@wherever.net', To => 'Joe User <joe.user@wherever.net>', Subject => $subject, Message => "A message to all my fans... Love, Stitch Jones" );
If I put the people for the "To" header into the external file in this format:
Joe User <joe.user@wherever.net>and read that into a variable $recipients, and then try to mail, Sendmail fails using this syntax:
To => $recipients,So I've done something like this (to get the single quotes Sendmail apparently needs):
To => "\'.$recipients.\'",The above WILL send the mail but when the mail arrives the "To:" header in the mail is empty so you can't see (or "reply to all") to the email and get the original receivers as well as the person/email it was sent "From". Seems like it should not work since it is syntactically odd (seems this would be more correct):
To => "\'" . $recipients . "\'",Running the above nets a "connection failed" to the SMTP server.
Any help here, fellow Monks on getting Sendmail to accept the "To" item from a variable (I've stuck the single apostrophes into the string too with bad results) and still show the To: header properly when the email arrives?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Sendmail module question
by zentara (Cardinal) on Aug 19, 2010 at 18:16 UTC | |
|
Re: Sendmail module question
by FunkyMonk (Bishop) on Aug 19, 2010 at 18:24 UTC |