Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
Email::MIME::RFC2047(3User Contributed Perl DocumentatiEmail::MIME::RFC2047(3)

NAME
       Email::MIME::RFC2047 - Correct handling of non-ASCII MIME headers

VERSION
       version 0.97

SYNOPSIS
	   use Email::MIME;

	   # create headers with non-ASCII chars

	   use Email::MIME::RFC2047::Encoder;
	   use Email::MIME::RFC2047::Mailbox;

	   my $email = Email::MIME->create();
	   my $encoder = Email::MIME::RFC2047::Encoder->new(
	       encoding	=> 'utf-8',
	       method	=> 'Q',
	   );

	   $email->header_set(
	       Subject => $encoder->encode_text($non_ascii_subject)
	   );

	   my $to_address = Email::MIME::RFC2047::Mailbox->new(
	       name    => $non_ascii_name,
	       address => $email_address,
	   );
	   $email->header_set(To => $to_address->format($encoder));

	   # parse headers with	non-ASCII chars

	   use Email::MIME::RFC2047::Decoder;

	   my $email = Email::MIME->new($message);
	   my $decoder = Email::MIME::RFC2047::Decoder->new();

	   my $subject = $decoder->decode_text($email->header('Subject'));

	   my $to_address = Email::MIME::RFC2047::AddressList->parse(
	       $email->header('To')
	   );

DESCRIPTION
       This distribution tries to provide a correct and	usable implementation
       of RFC 2047 "MIME Part Three: Message Header Extensions for Non-ASCII
       Text".  The Encode::MIME::Header	module also provides RFC 2047 encoding
       and decoding but	a useful API should handle the different situations
       where RFC 2047 encoded headers are used.	Section	5 of the RFC defines
       three use cases for 'encoded-words':

       (1) As a	replacement of 'text' tokens, for example in a Subject header

       (2) In comments

       (3) As a	replacement for	a 'word' entity	within a 'phrase', for
       example,	one that precedes an address in	a From,	To, or Cc header

       Especially, case	(3) requires the handling of quoted strings as defined
       by RFC 2822. So the encoding and	decoding modules provide separate
       methods for the handling	of text	and phrases.

       Since parsing and encoding of phrases makes up the bulk of handling
       address headers like From, To or	Cc, additional modules to handle these
       headers are also	provided.

       See Email::MIME::RFC2047::Encoder for encoding.

       See Email::MIME::RFC2047::Decoder for decoding.

       See Email::MIME::RFC2047::Mailbox for handling of Sender	headers.

       See Email::MIME::RFC2047::MailboxList for handling of From headers.

       See Email::MIME::RFC2047::AddressList for handling of Reply-To, To, Cc
       and Bcc headers.

       See Email::MIME::RFC2047::Group for handling groups of mailboxes.

AUTHOR
       Nick Wellnhofer <wellnhofer@aevum.de>

COPYRIGHT AND LICENSE
       This software is	copyright (c) 2017 by Nick Wellnhofer.

       This is free software; you can redistribute it and/or modify it under
       the same	terms as the Perl 5 programming	language system	itself.

perl v5.32.0			  2017-07-31	       Email::MIME::RFC2047(3)

NAME | VERSION | SYNOPSIS | DESCRIPTION | AUTHOR | COPYRIGHT AND LICENSE

Want to link to this manual page? Use this URL:
<https://www.freebsd.org/cgi/man.cgi?query=Email::MIME::RFC2047&sektion=3&manpath=FreeBSD+12.2-RELEASE+and+Ports>

home | help