메일 헤더부분에서 From:, Subject:그리고, To:를잡아내려고
하는데 메일 헤어에 보니 정말 다양하게 나와서리. 음냐.
특히 윈도에 기본으로 되어있는 ks_c_5601-1987 로 오는 경우는
너무나 많은데 다들 처리를 안해주고 있어서리. 쩝.
이렇게 하면 안될 것 같은데 그냥 지금 필요하니까.
이것 말고 할 일 많은데 여기서 시간끌면 조금 그래서리.
yuletide
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
[ks_c_5601-1987를 가지는 메일 헤더에 대한 처리법]
o 하고자 하는바
ks_c_5601-1987를 가지는 메일헤더에 대한 처리
o 과정
=?EUC-KR?B?w6XAuyDF68Okt84=?=
=?ks_c_5601-1987?B?Rlc6IMGkurjIrcPLwfix4rHdIL3Fw7sgx/nBtsDHt9o=?=
결국 표기만 틀릴뿐 하는 일은 똑같음.(맞나!?!)
=?ks_c_5601-1987?B?과 ?=사이에 있는 것을 MATCH시켜서 디코딩하려 했음
mmencode -u를 이용하려 했음
procmail에 대한 이해부족으로 실패
hcode2.1-mailpatch3에 대해서 수정을 가하기로 함
o 한일
[yctae@yctae hcode2.1-mailpatch3]$ cat -n mail.c | grep ks_c
166 char *charset<> = {"EUC-KR", "ISO-2022-KR", "ks_c_5601-1987", NULL};
hcode2.1-mailpatch3로는 ks_c_5601-1987를 처리하지 못해서 이부분에 추가했음.
그리고, /etc/procmailrc에
:0 Efhw
*^(Subject|From):.*=?ks_c_5601-1987?(B|Q)?/
| formail -c | hcode -dk -m
를 추가했음.
o 결론
이것으로 ks_c_5601-1987를 가지는 메일에 대해서 처리가 가능해졌음.
o 추가
------------------
/etc/procmailrc
note: 장우현님의 sendmail 이야기에 위의 부분만 추가
------------------
[yctae@yctae hcode2.1-mailpatch3]$ cat /etc/procmailrc
LOGFILE=/var/log/procmail
VERBOSE=no
PATH=/usr/local/bin:/usr/bin:/bin
SHELL=/bin/sh
:0 B
*^.$)C
{
:0 fbw
|hmconv -u
:0 fhw
* ^Content-Type: text/plain
|formail -c -I "Content-Type: text/plain; charset=EUC-KR" -I
"Content-Transfer-Encoding: 8bit"
:0 Efhw
* ^Content-Type: text/html
|formail -c -I "Content-Type: text/html; charset=EUC-KR" -I
"Content-Transfer-Encoding: 8bit"
:0 Efhw
* !^Content-Type:
|formail -c -I "Content-Type: text/plain; charset=EUC-KR" -I
"Content-Transfer-Encoding: 8bit"
# Note that '-c' flag has been added to formail invocation.
# It concatenates a header of multiple lines into a single line
# so that a bug in 'hcode -dk -m' dealing with RFC 2047 encoded header
# has less 'harmful' effect.
:0 fhw
| formail -A
"X-Automatic-Korean-Mail-Conversion: iso-2022-kr to euc-kr"
}
DROPPRIVS=yes
:0 fhw
*Content-Type:.+; charset="?EUC-KR
| formail -c | hcode -dk -m
:0 Efhw
*^(Subject|From|Cc):.*=?EUC-KR?(B|Q)?
| formail -c | hcode -dk -m
:0 Efhw
*^(Subject|From):.*=?ks_c_5601-1987?(B|Q)?/
| formail -c | hcode -dk -m