php, postfix UTF8 메일 발송 실패.
글쓴이: 송지석 / 작성시간: 화, 2005/04/12 - 8:05오후
문제가 두가지입니다.
하나는 커맨드라인에서 UTF-8로 메일을 보내도 인코딩이 ISO8859-1로 되는 겁니다.
두번째는 php로 메일 보낼 때 받는 사람 이름에 한글이 있으면(UTF-8이면) 메일 보내는 데 실패합니다. 커맨드라인에서 보내보면 한글 이름이 있어도 보내집니다.(대신에 읽어보면 인코딩이 서양어로 되어있어서 깨져보입니다.)
다음은 eventum으로 메일을 보내다 실패한 로그입니다.
메일 서버는 postfix를 쓰고 Fedora Core3 입니다.
무슨 문제 인지.. 서버설정쪽은 잘 몰라서.. 방법을 아시는 분 있으신가요?
Hello,
An error was found at 04/12/2005 19:55:01 (1113303301) on line '222' of script '/var/www/html/eventum/include/class.mail_queue.php'.
The error message passed to us was:
'unable to send data'
A more detailed error message follows:
''
That happened on page '' from IP Address '' coming from the page (referrer) ''.
The user agent given was ''.
Sincerely yours,
Automated Error_Handler Class
A backtrace is available:
Array
(
[0] => Array
(
[file] => /var/www/html/eventum/include/class.mail_queue.php
[line] => 165
[function] => _sendemail
[class] => mail_queue
[type] => ::
[args] => Array
(
[0] => =?utf-8?Q?=EC=86=A1=EC=A7=80=EC=84=9D_Daniel_J._Song?= <jssong@company.com>
[1] => MIME-Version: 1.0
From: root@team1.company.com
To: =?utf-8?Q?=EC=86=A1=EC=A7=80=EC=84=9D_Daniel_J._Song?= <jssong@wooritg.com>
Subject: Eventum: User account information updated
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
Date: Tue, 12 Apr 2005 19:17:30 +0900
[2] => Your user account has been updated in Eventum.
Your account information as it now exists appears below.
----------------------------------------------------------------------
Full Name: ì\206¡ì§\200ì\204\235 Daniel J. Song
Email Address: jssong@company.com
Assigned Projects: Default Project: Developer
----------------------------------------------------------------------
http://pear.php.net/bugs/bug.php?id=2242 에 보면
Quote:
After hours, I've found a solution for my Problem. If you
use quotemarks for the personal-part of an e-mail the RFC
822-Test will pass.
e.g use:
"Bau =?UTF-8?Q?Dr=C3=B6mling?= e.G" - Hauptsitz
<name@example.de>
instead of:
Bau =?UTF-8?Q?Dr=C3=B6mling?= e.G - Hauptsitz
<name@example.de>
By The Way the RFC 822-Test shouldn't fail if you don't
use quotemarks. And the Mail-package should send such an
Mail.
이런 얘기가 나오는데요. (eventum도 내부에서 PEAR사용) 여기 나온대로 만든다면 될 수도 있나요? 어떻게 할 지 알려주세요..
Forums:


[code:1]/* Send Email */function sen
/* Send Email */ function send_email($fromname, $fromemail, $toname, $toemail, $subject, $contents, $charset = 'euc-kr') { mail( $toemail, '=?'.$charset.'?b?'.base64_encode($subject).'?=', chunk_split(base64_encode($contents)), "Content-Type: text/html; charset=$charset\n". "Content-Transfer-Encoding: base64\n". 'From: =?'.$charset.'?b?'.base64_encode($fromname)."?= <$fromemail>" ); return true; }php 쪽 에러를 보니 7bit 로 보내려고 시도하네요.
인코딩도 urlencode() 한것과 비슷하게 되어있고...
요걸로 보내보세요. base64 인코딩 해서 보내는겁니다.
https://xenosi.de/
댓글 달기