Skip to content

Commit

Permalink
Describe a few things in some clearer detail.
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Nehren authored and ranguard committed Sep 10, 2011
1 parent 82e27ff commit ccec5bb
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions lib/perlfaq9.pod
Expand Up @@ -451,12 +451,24 @@ the MIME/QP encoding. Decoding BASE64 becomes as simple as:
use MIME::Base64;
$decoded = decode_base64($encoded);

The Email::MIME module can decode base 64-encoded parts transparently so
the developer doesn't need to worry about it.
The Email::MIME module can decode base 64-encoded email message parts
transparently so the developer doesn't need to worry about it.

=head2 How do I return the user's mail address?

Ask them for it.
Ask them for it. There are so many email providers available that it's
rather unlikely the local system has any idea how to determine a user's
email address. The one notable exception is for organization-specific
email (e.g. foo@yourcompany.com) where policy can be codified in your
program. In that case, you can look at $ENV{USER}, $ENV{LOGNAME}, and
getpwuid($<) in scalar context, like so:

my $user_name = getpwuid($<)

But note that you still cannot make any assumptions about whether this
is correct unless your policy says it is. And then there are things like
localpart extensions (foo+bar@example.com). You really are best off
asking the user.

=head2 How do I send mail?

Expand Down Expand Up @@ -506,7 +518,8 @@ Telling Email::Sender::Simple to use your transport is straightforward.
Email::MIME directly supports multipart messages, and in fact the simple
case of a plaintext email still has one 'attachment'. Email::MIME
objects themselves are parts and can be attached to other Email::MIME
objects.
objects. Consult the Email::MIME documentation for more information,
including all of the supported methods and examples of their use.

=head2 How do I read mail?

Expand All @@ -521,6 +534,10 @@ Use the Email::Folder module, like so:
my $mime = Email::MIME->new($message->as_string);
}

There are different classes in the Email::Folder namespace for
supporting various mailbox types. Note that these modules are generally
rather limited and only support B<reading> rather than writing.

=head2 How do I find out my hostname, domainname, or IP address?
X<hostname, domainname, IP address, host, domain, hostfqdn, inet_ntoa,
gethostbyname, Socket, Net::Domain, Sys::Hostname>
Expand Down

0 comments on commit ccec5bb

Please sign in to comment.