From ccec5bbb87e5979c66682617a985534564bc4772 Mon Sep 17 00:00:00 2001 From: Chris Nehren Date: Mon, 5 Sep 2011 22:50:09 -0400 Subject: [PATCH] Describe a few things in some clearer detail. --- lib/perlfaq9.pod | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/lib/perlfaq9.pod b/lib/perlfaq9.pod index a29ddfc..60e9552 100644 --- a/lib/perlfaq9.pod +++ b/lib/perlfaq9.pod @@ -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? @@ -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? @@ -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 rather than writing. + =head2 How do I find out my hostname, domainname, or IP address? X