畑正憲 > Lingua-JA-Mail-0.03 > Lingua::JA::Mail

Download:
Lingua-JA-Mail-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.03   Source  

NAME ^

Lingua::JA::Mail - compose mail with Japanese charset

SYNOPSIS ^

 use utf8;
 use Lingua::JA::Mail;
 
 $mail = Lingua::JA::Mail->new;
 
 $mail->add_from('taro@cpan.tld', 'YAMADA, Taro');
 
 # display-name is omitted:
  $mail->add_to('kaori@cpan.tld');
 # with a display-name in US-ASCII characters:
  $mail->add_to('sakura@cpan.tld', 'Sakura HARUNO');
 # with a display-name containing Japanese characters:
  $mail->add_to('yuri@cpan.tld', 'NAME CONTAINING JAPANESE CHARS');
 
 # mail subject containing Japanese characters:
  $mail->subject('Subject', 'SUBJECT CONTAINING JAPANESE CHARS');
 
 # mail body    containing Japanese characters:
  $mail->body('BODY CONTAINING JAPANESE CHARS');
 
 # compose and output
  print $mail->compose;

DESCRIPTION ^

This module is produced mainly for Japanese Perl programmers those who wants to compose an email with Perl extention.

For some reasons, most Japanese internet users have chosen ISO-2022-JP 7bit character encoding for email rather than the other 8bit encodings (eg. EUC-JP, Shift_JIS).

We can use ISO-2022-JP encoded Japanese text as message body safely in an email.

But we should not use ISO-2022-JP encoded Japanese text as a header. We should escape some reserved special characters before composing a header. To enable it, we encode ISO-2022-JP encoded Japanese text with MIME Base64 encoding. Thus MIME Base64 encoded ISO-2022-JP encoded Japanese text is safely using in a mail header.

This module has developed to intend to automate those kinds of operations.

METHODS ^

Constructor Method

new

This method is the constructor class method.

Building the Header Fields

See Lingua::JA::Mail::Header for the descriptions.

Compose the Message Body with Header Fields.

body($text)

This method specifies the body of the message. It can contain Japanese characters.

Note: RFC1468 describes about a line should be tried to keep length within 80 display columns. Then each JIS X 0208 character takes two columns, and the escape sequences do not take any. This module itself does not provide any auto-folding functions. See Lingua::JA::Fold about the folding of Japanese text.

compose

This method gathers and builds the header fields, then convine with the body of the message and then returns the overall message.

sendmail([$location])

This method composes the overall message (see compose) and pipes the data to the sendmail program. Posts a mail using sendmail program.

At the default, it is supposed that the sendmail command is `sendmail' under a location of systems's PATH environmental variable. You can specify exact location. Ex:

 $mail->sendmail('/usr/bin/sendmail');

SEE ALSO ^

module: Lingua::JA::Mail::Header
RFC2822: http://www.ietf.org/rfc/rfc2822.txt (Mail)
RFC2045: http://www.ietf.org/rfc/rfc2045.txt (MIME)
RFC2046: http://www.ietf.org/rfc/rfc2046.txt (MIME)
RFC2047: http://www.ietf.org/rfc/rfc2047.txt (MIME)
RFC1468: http://www.ietf.org/rfc/rfc1468.txt (ISO-2022-JP)
module: Encode
module: MIME::Base64

NOTES ^

This module runs under Unicode/UTF-8 environment (hence Perl5.8 or later is required), you should input octets with UTF-8 charset. Please use utf8; pragma to enable to detect strings as UTF-8 in your source code.

TO DO ^

Attachment file support.

THANKS TO: ^

Koichi TANIGUCHI for the suggestions.

AUTHOR ^

Masanori HATA <lovewing@dream.big.or.jp> (Saitama, JAPAN)

COPYRIGHT ^

Copyright (c) 2003-2005 Masanori HATA. All rights reserved.

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

syntax highlighting: