NAME

Mail::ISO2022JP - compose ISO-2022-JP encoded email

SYNOPSIS

use Mail::ISO2022JP;

$mail = Mail::ISO2022JP->new;
$mail->set('From_addr', 'taro@cpan.tld');
$mail->set('To_addr'  , 'sakura@cpan.tld, yuri@cpan.tld');
# mail subject containing Japanese characters.
$mail->set('Subject'  , '日本語で書かれた題名');
# mail bocy    containing Japanese characters.
$mail->set('Body'     , '日本語で書かれた本文。');
# convert body to ISO-2022-JP (from UTF-8)
$mail->iso2022jp('Body');
# output the composed mail
print $mail->compose;

DESCRIPTION

This module is mainly for Japanese perl programmers. Because of its 7bit/US-ASCII character based regulation, an internet mail is required to compose through some encoding process when it includes non-7bit/US-ASCII characters. ISO-2022-JP is one of Japanese character encoding, which is usually used among Japanese people for the mail encoding. For ISO-2022-JP is 7bit encoding, to use it in mail message body has no problem. But it still has problem to use ISO-2022-JP in mail headers, since mail headers should be expressed only in US-ASCII characters. Then we should encode ISO-2022-JP header data (ex. sender name, recipient name, subject) again with MIME Base64 method. This module automates those kinds of operations.

METHODS

new()

Creates a new object.

set('From_addr', $address)

To set originator address. $address should be valid as email address.

set('To_addr', $address)

To set destination address. $address should be valid as email address. Comma separated multiple destination addresses are also usable.

set('Subject', $subject)

To set mail subject. $subject can contain Japanese characters. Note that this module runs under Unicode/UTF-8 environment, you should input these data in UTF-8 character encoding.

set('Body', $body)

To set mail body. $body can contain Japanese characters. Note that this module runs under Unicode/UTF-8 environment, you should input these data in UTF-8 character encoding.

iso2022jp('Body')

Converts mail body (which has already been input) into ISO-2022-JP encoding (from UTF-8).

compose

Compose and output a formed email.

date($date_string)

Specifies mail origination date. This method must used before compose() method when you want to specify this value. Of course, date-time format should be compliant to the format of RFC2822 specification. It is like blow:

Mon, 10 Mar 2003 18:48:06 +0900

Origination date is not a essential information for email (sendmail program will add automatically on posting). Don't forget to quote the string.

post() *EXPERIMENTAL*

Posts a mail using sendmail program. At the default setting, it is supposed that sendmail program's name is `sendmail' under the systems's PATH environmental variable. You can specify exact location with sendmail() method.

sendmail($path) *EXPERIMENTAL*

Specifies sendmail location. ex. '/usr/bin/sendmail'

SEE ALSO

Encode
MIME::Base64
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)

NOTES

This module runs under Unicode/UTF-8 environment (then Perl5.8 or later is required), you should input data in UTF-8 character encoding.

Additionally, this POD contains Japanese Unicode/UTF-8 characters. Some characters cannot be displayed correctly without proper fonts and on a pager which cannot handle Unicode/UTF-8.

TO DO

enable originator/destination name containing Japanese characters.

AUTHOR

Masanori HATA <lovewing@geocities.co.jp> (Saitama, JAPAN)

COPYRIGHT

Copyright (c) 2003 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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 220:

Non-ASCII character seen before =encoding in ''日本語で書かれた題名');'. Assuming UTF-8