Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling


by Anonymous Monk
on Nov 07, 2000 at 23:37 UTC ( [id://40401]=perlquestion: print w/replies, xml ) Need Help??

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have a script using Mail::Mailer module for Perl and when ever I send mail using it, I only pass one word to the "From" variable, yet when the mail comes back it gets an appended to it. Eg.) from = testing and when I get the mail back it has From: Should I put a switch of some type on the ("sendmail") portion of this script?
{ use Mail::Mailer; use strict; my ($to, $from, $subject, $body) = ( @_); my $mailer = Mail::Mailer->new("sendmail"); $mailer->open({ From => $from, To => $to, Subject => $subject, }); print $mailer $body; $mailer->close();

Replies are listed 'Best First'.
Re: Mail::Mailer
by kilinrax (Deacon) on Nov 07, 2000 at 23:48 UTC
    That's not a bug, it's a feature ;-)
    Your MTA will automatically append the local domain to any email addresses that do not specify a domain.
    You may well be able to configure sendmail not to do this, but I don't know how.
    To the best of my knowledge, you can't pass flags to sendmail using Mail::Mailer.
Re: Mail::Mailer
by extremely (Priest) on Nov 08, 2000 at 07:41 UTC
    You should put a real address there. =) If the word is real important, try making up an address with name and letting the important word (e.g. testing) be the "name" of the user. Make your MTA happy and your MTA will still drive you nuts... but at least you'll be doing it correctly!
    $mailer->open({ From => "$from <root\@place.dom>", To => $to, Subject => $subject, }); ## or $mailer->open({ From => "$from <$from\@place.dom>", To => $to, Subject => $subject, });

    $you = new YOU;
    honk() if $you->love(perl)

RE: Mail::Mailer
by mitd (Curate) on Nov 08, 2000 at 03:13 UTC
    You could try using sendmail's '-f' switch, but here read this quote from the sendmail manpage.

    <quote> -f name
    Sets the name of the ``from'' person (i.e., the sender of the ail). -f can only be used by ``trusted'' users (normally root, daemon, and network) or if the person you are trying to become is the same as the person you are. </quote>

    mitd-Made in the Dark
    'My favourite colour appears to be grey.'

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://40401]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-07-13 00:16 GMT
Find Nodes?
    Voting Booth?

    No recent polls found

    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.