Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[13718] 이메일보내기 질문입니다(delphi2009,indy 10.2.5 )
준초보 [jangsek1] 2613 읽음    2011-05-26 12:14
Delphi 2009 indy 10.2.5 에서 smtp 로 메일을 보내려구 합니다.

제가 궁금한 부분은 한글처리 부분입니다

아래와 같이 코딩했는데 깨지는 현상이 일어납니다. 인터넷에 아무리 돌아다녀도 답을 못찾겠네요

아시는분 조언좀 부탁드립니다.


===========================================================
function StrToBytes(text: string; codePage: Word): TBytes;
begin
  case codePage of
    0: Result := TEncoding.Default.GetBytes(text);
    1200: Result := TEncoding.Unicode.GetBytes(text);
    1201: Result := TEncoding.BigEndianUnicode.GetBytes(text);
    20127: Result := TEncoding.ASCII.GetBytes(text);
    65000: Result := TEncoding.UTF7.GetBytes(text);
    65001: Result := TEncoding.UTF8.GetBytes(text);
  else
    begin
      if codePage = GetACP() then begin
        Result := TEncoding.Default.GetBytes(text);
      end else
      begin
        with TEncoding.GetEncoding(codePage) do
        try
          Result := GetBytes(text);
        finally
          Free;
        end;
      end;
    end;
  end;
end;


  with IdMessage  do
    begin
      Clear;
      ClearBody;
      MessageParts.Clear;
      ClearHeader;
      ContentType := 'text/html';
      CharSet := 'ks_c_5601-1987';
      Headers.Add('Content-type: text/html');
      Encoding := meMIME;

      Bytes := StrToBytes('가나다라마바사', 65001);
      From.name := BytesToString(Bytes);
      Subject := BytesToString(Bytes,enUTF8);
      Body.Text := BytesToString(Bytes);

      ReplyTo.EMailAddresses := edtTo.Text;
      Recipients.EMailAddresses := edtTo.Text; { To: header }

      Priority := TIdMessagePriority(cboPriority.ItemIndex); { Message Priority }
      if chkReturnReciept.Checked then
      begin {We set the recipient to the From E-Mail address }
        ReceiptRecipient.Text := From.Text;
      end
      else
      begin {indicate that there is no receipt recipiant}
        ReceiptRecipient.Text := '';
      end;
    end;

+ -

관련 글 리스트
13718 이메일보내기 질문입니다(delphi2009,indy 10.2.5 ) 준초보 2613 2011/05/26
13758     Re:이메일보내기 질문입니다(delphi2009,indy 10.2.5 ) 정병선 3858 2011/07/13
13759         꽤 오래전에 올린질문이라 나름 포기상태 였는데 답변 정말 감사합니다. (냉무) 준초보 2002 2011/07/13
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.