Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: How can I extract the username/domain?

by wog (Curate)
on Nov 21, 2001 at 06:40 UTC ( [id://126711]=note: print w/replies, xml ) Need Help??


in reply to How can I extract the username and hostname/domain from e-mail addresses?

The Mail::Address and Mail::Header modules can do this task:

use Mail::Header; use Mail::Address; my $header = Mail::Header->new([@lines]); my($from) = Mail::Address->parse($header->get("From")); my($user,$host) = ($from->user(),$from->host());

Edit by tye

Replies are listed 'Best First'.
Re: Re: How can I extract the username/domain?
by wog (Curate) on Nov 21, 2001 at 06:44 UTC
    my $from = Mail::Address->parse($header->get("From"));
    should be
    my($from) = Mail::Address->parse($header->get("From"));
    (because Mail::Address->parse returns an array, and we don't want it's length.)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2024-03-28 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found