Mail::Builder::Address - Module for handling e-mail addresses
use Mail::Builder; my $mail = Mail::Builder::Address->new('mightypirate@meele-island.mq','Gaybrush Thweedwood'); # Now correct type in the display name and address $mail->name('Guybrush Threepwood'); $mail->email('verymightypirate@meele-island.mq'); $mail->comment('Mighty Pirate (TM)'); # Serialize print $mail->serialize; # Use the address as a recipient for Mail::Builder object $mb->to($mail); # Removes all other recipients OR $mb->to->add($mail); # Adds one more recipient (without removing the existing ones)
This is a simple module for handling e-mail addresses. It can store the address and an optional display name.
Mail::Builder::Address->new(EMAIL[,DISPLAY NAME[,COMMENT]]); OR Mail::Builder::Address->new({ email => EMAIL, [ name => DISPLAY NAME, ] [ comment => COMMENT, ] }) OR my $email = Email::Address->parse(...); Mail::Builder::Address->new($email);
Simple constructor
Prints the address as required for creating the e-mail header.
$obj->compare(OBJECT); or $obj->compare(E-MAIL);
Checks if two address objects contain the same e-mail address. Returns true or false. The compare method does not check if the address names of the two objects are identical.
Instead of a Mail::Builder::Address object you can also pass a scalar value representing the e-mail address.
Mail::Builder::Address
Display name
E-mail address. Will be checked with Email::Valid Email::Valid options may be changed by setting the appropriate values in the %Mail::Builder::TypeConstraints::EMAILVALID hash.
Eg. if you want to disable the check for valid TLDs you can set the 'tldcheck' option (without dashes 'tldcheck' and not '-tldcheck'):
$Mail::Builder::TypeConstraints{tldcheck} = 0;
Required
Comment
Maroš Kollár CPAN ID: MAROS maros [at] k-1.com http://www.k-1.com
To install Mail::Builder, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mail::Builder
CPAN shell
perl -MCPAN -e shell install Mail::Builder
For more information on module installation, please visit the detailed CPAN module installation guide.