ã¡ã¼ã«éä¿¡
ã¢ãã³ãªã¡ã¼ã«ã®éä¿¡æ³
ã¢ãã³ã¨è¨ã£ã¦ãããããäºã¯ããã¾ããï¼ä»äºã§ä½¿ã£ã¦ããnagiosç¨ã®ã¹ã¯ãªãããè¦ããjcode.plã使ã£ã¦ãã¦ï¼ãã¤ããåããã®ã使ã£ã¦ããã ããã¨ãã£ããããã®ã§ãªãã¨ãªãæ¸ãã¦ã¿ã¾ããï¼æè¿ã®æ¥æ¬èªå¦çã¯Encode.pmã§ããï¼subjectã®MIMEã¨ã³ã³ã¼ããããã ãã§ãããã§ãï¼
ç°¡åãªéä¿¡æ¹æ³
mailã³ãã³ãã使ã£ã¦ã¡ã¼ã«ãéä¿¡ãã¾ãï¼éä¿¡ã§ããç°å¢ã«ãªã£ã¦ããã®ãåæã§ããï¼æ°ã«ããªãã¨ãããªãã®ã¯ï¼ã¹ã¯ãªããã«ããã¹ããèªè¾¼ãæã«decodeãã¦ï¼æ¸ãåºãæã«encodeãããã¨ã§ãï¼ã¡ã¼ã«ã®æ¬ä½ã¯JISã³ã¼ãã§ä»¶å(Subject)ã¯MIMEã¨ã³ã³ã¼ããã¾ãããï¼
#!/usr/bin/perl use utf8; use Encode; use strict; use warnings; my ( $body, $header, $mail_command ); $body=<<EOD; å°å ´ã§ãï¼ ã¡ã¼ã«ã®æ¬æãutf8ã§æ¸ãã¾ãããï¼ å¾ã§jisã³ã¼ãã«å¤æãã¾ãï¼ EOD $header = 'è¦ä»¶ãæ¥æ¬èªã§æ¸ãã¾ããã'; $header = encode( 'MIME-Header-ISO_2022_JP', $header ); $mail_command = 'mail -s ' . $header . ' [email protected]'; open( MAIL, '|-', $mail_command ); $body = encode('jis', $body); print MAIL $body; close MAIL;
ç°¡åã§ããï¼å¾ã¯$bodyã®ä½ãæ¹ã工夫ãã¦ã¿ã¦ãã ãããªï¼