Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Mail::Mailer

by Anonymous Monk
on Nov 07, 2000 at 23:37 UTC ( #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 @firewall-mydomain.com appended to it. Eg.) from = testing and when I get the mail back it has From: testing@firewall-mydomain.com 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?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (5)
As of 2023-02-03 23:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer not to run the latest version of Perl because:







    Results (30 votes). Check out past polls.

    Notices?