Uwe
  • Uwe
  • 54.5% (Neutral)
  • Newbie Topic Starter
2 years ago
Hi @All,

C++/MFC/MultiByte/EASendmail ActiveX

how do I handle oSmtp->Subject with German umlauts.
e.g.

CString strSubject = _T("Rückstandsliste"); // backorder list

oSmtp->HeaderEncoding = 1; // or 2
oSmtp->Subject = _bstr_t(strSubject);

the receiver get a "?" for the umlaut "ü"

how do I do it right ?

Thank you
-Uwe
ivan
  • ivan
  • 100% (Exalted)
  • Administration
2 years ago
Try to use this and see if it will work, do you set Unicode charset in your project?
oSmtp->Subject = L"Rückstandsliste";

Uwe
  • Uwe
  • 54.5% (Neutral)
  • Newbie Topic Starter
2 years ago
Hello ivan,

I think I have come a little closer to the matter.

When I create a new mail, the encoder of EASenmail is called and the subject is coded correctly.

oSmtp->HeaderEncoding = 1;
oSmtp->AuthType = AuthXoauth2;
oSmtp->UserName = strKonto.AllocSysString();
oSmtp->Password = accessToken;
oSmtp->FromAddr = strFrom.AllocSysString();
oSmtp->ReplyTo = strReplyTo.AllocSysString();
oSmtp->Subject = strSubject.AllocSysString(); // _T("Rückstandsliste")
oSmtp->BodyText = strMailBody.AllocSysString();
Receiver see Subject: Rückstandsliste <----- ok

But if I load an existing mail with LoadMessage() and change the subject, , it seems that the encoder is not called.


oSmtp->LoadMessage(strEMLFile.AllocSysString()); <-------------- stored from EAGetMail
oSmtp->HeaderEncoding = 1;
oSmtp->AuthType = AuthXoauth2;
oSmtp->UserName = strKonto.AllocSysString();
oSmtp->Password = accessToken;
oSmtp->FromAddr = strFrom.AllocSysString();
oSmtp->ReplyTo = strReplyTo.AllocSysString();
oSmtp->Subject = strSubject.AllocSysString(); // _T("Rückstandsliste")
oSmtp->BodyText = strMailBody.AllocSysString();
Receiver see Subject: R?ckstandsliste <--------- failure

As a workaround, I use another encoder before assigning the subject.

easendmail_v7909
eagetmail_v5258
ActiveX

Thank you for your help

Greetings
-Uwe
ivan
  • ivan
  • 100% (Exalted)
  • Administration
2 years ago
Hi, please contact our support email address (support@emailarchitect.net) and send your eml file for assistance.

Additionally,

// this will cause memory leak.
oSmtp->Subject = strSubject.AllocSysString();

// please change it to:
BSTR bstrSubject = strSubject.AllocSysString();
oSmtp->Subject = bstrSubject;
::SysFreeString(bstrSubject);
Uwe
  • Uwe
  • 54.5% (Neutral)
  • Newbie Topic Starter
2 years ago
Hi ivan,

ups, thank you for the hint with AllocSysString. Much appreciated!

At the same time I send you some sample.eml with my observations about umlauts for your evaluation. If you have any further questions or something is missing, please contact me.

Many sincere thanks
-Uwe
Users browsing this topic

    EXPLORE TUTORIALS

    © All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.