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

C++빌더 Q&A
C++Builder Programming Q&A
[74480] Re:인디컴포넌트 이메일 다국어지원 문제 고민중입니다
초행길 [] 1690 읽음    2017-07-19 02:44
아주 오래된 글이지만, 혹시 다른 분들에게 도움이 될까 싶어서..... 답 글을 합니다.
아래 코드를 보시고, 참고하세요.

    IdSMTP1->Host = stHost ;
    IdSMTP1->Port     = StrToInt(stPort) ;
    IdSMTP1->Username = stUser ;
    IdSMTP1->Password = stPswd ;

    IdMessage1->Clear() ;
    IdMessage1->ClearHeader() ;
    IdMessage1->ClearBody() ;
    IdMessage1->MessageParts->Clear() ;
    IdMessage1->Body->Clear() ;
    IdMessage1->CharSet = "UTF-8";                                                //   <================== UTF-8
    IdMessage1->From->Address = stUser ;
    IdMessage1->Recipients->EMailAddresses = stEmail ;
    if (stCcEmail.Length()>5) {
        MainForm->IdMessage1->CCList->EMailAddresses     = stCcEmail ; 
    };
    if (stBccEmail.Length()>5) {
            IdMessage1->BccList->EMailAddresses = stBccEmail ;
        };
    IdMessage1->Subject = stSubject ;
    IdMessage1->Body->Add( stMsg ) ;

    if (stlFiles->Count > 0) {
        IdMessage1->ContentType = "multipart/mixed";

        TIdMessageBuilderPlain *myMessage = new TIdMessageBuilderPlain();  //#include <IdMessageBuilder.hpp> add attachment file
        for (int i = 0; i < stlFiles->Count ; i++) {
            myMessage->Attachments->Add( stlFiles->Strings[i] );
        } ;
        myMessage->PlainTextCharSet = "UTF-8";                             //  <================== UTF-8
        myMessage->PlainText->Text = stMsg ;
        myMessage->FillMessage(IdMessage1) ;

        delete myMessage ;

    } ;
    Application->ProcessMessages();

    try {
        if (!IdSMTP1->Connected())     IdSMTP1->Connect() ;
        IdSMTP1->Authenticate();
        IdSMTP1->Send(IdMessage1);
    } catch (...) {
        IdSMTP1->Disconnect();
        return false ;
    } ;

    IdSMTP1->Disconnect();










김상욱 님이 쓰신 글 :
: 안녕하세요 고수님들
: 저는 인디컴포넌트를 사용하여 메일보내는 프로그램을
: 만들고 있읍니다.
: 근데 중국어나 일본어와 같은 다국어지원을 위해서 한참고민
: 하고 있읍니다.
:
: TidMessage의 CharSet=UTF-8
:                         ContentTransferEncoding=base64
:                         ContentType=text/plain
:
: SMTP서버는 gmail을 쓰고 있고요
: 근데 자꾸만 받는쪽에서 글자가 깨지거나 ? 표시가 나옵니다.
:
: 많은고수님들의 지도 부탁드립니다
: 좋은하루 되세요

+ -

관련 글 리스트
69991 인디컴포넌트 이메일 다국어지원 문제 고민중입니다 김상욱 2209 2013/08/14
74480     Re:인디컴포넌트 이메일 다국어지원 문제 고민중입니다 초행길 1690 2017/07/19
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.