We help IT Professionals succeed at work.
Get Started

Turkish Language character problem when sending e-mail using indy 10

mhanefitel
mhanefitel asked
on
1,556 Views
Last Modified: 2013-11-23
Hi,
    Below is the code Delphi BDS 2006 Indy 10. When i send e-mail using Turkish language character i get incorrect wiew on e-mail client side.

On MS Outlook 2007 :

Subjet : ýýýý ÜÜÜ ÞÞÞ ÇÇÇ ÝÝÝ ÐÐÐ ÖÖÖ ööö ððð ççç þþþ
Body : iiii ÜÜÜ SSS ÇÇÇ III GGG ÖÖÖ ööö ggg ççç sss

On Yahoo :
Subject : ýýýý ÜÜÜ ÞÞÞ ÇÇÇ ÝÝÝ ÐÐÐ ÖÖÖ ööö ððð ççç þþþ (incorrect view)
Body : ¿¿¿¿ ¿¿¿ ¿¿¿ ¿¿¿ ¿¿¿ ¿¿¿ ¿¿¿ ¿¿¿ ¿¿¿ ¿¿¿ ¿¿¿  (incorrect view)

     How can i fix this problem? I want to send e-mail using Turkish language character and make sure that my e-mail is viewed on client side correctly.(correct Turkish language character are attached on jpeg file. )
     Thanks in advance.




 
procedure TForm1.Button1Click(Sender: TObject);
var Temp : String;
   mailMessage : TIdMessage;
   SMTPConnection : TIdSMTP;
   tempCharSet : String;
   tempEncoding : char;
   tempTransfer : TTransfer;
begin
  Screen.Cursor := crHourGlass;//mouse bekleme

  try
      mailMessage    := TIdMessage.Create;
      SMTPConnection := TIdSMTP.Create;

      mailMessage.ClearHeader;

   //   tempCharSet  := 'ISO-8859-9';
     // tempEncoding := 'B';
    //  tempTransfer := bit8;
    //  mailMessage.InitializeISO(tempTransfer,tempEncoding,tempCharSet);

      mailMessage.ContentTransferEncoding := '8bit';
      mailMessage.CharSet                 := 'ISO-8859-9';


      with mailMessage do
      begin
         Clear;
         From.Text                 := _fromEMail;
         From.Name                 := _fromName;
         ReplyTo.EMailAddresses    := '';
         Priority                  := mpNormal;
         Recipients.EMailAddresses := _toEMail;
         Subject                   := 'iiii ÜÜÜ SSS ÇÇÇ III GGG ÖÖÖ ööö ggg ççç sss';
      end;
      mailMessage.Body.Clear;
      mailMessage.ContentType := 'text/html';
      mailMessage.Body.Add('<html>');
      mailMessage.Body.Add('<head></head>');
      mailMessage.Body.Add('<body>');
      TEMP := mailMessage.Subject;
      mailMessage.Body.Add(TEMP);
      mailMessage.Body.Add('</body>');
      mailMessage.Body.Add('</html>');


      SMTPConnection.Username := _userName;
      SMTPConnection.Password := _userPass;
      SMTPConnection.Host     := _serverName;
      SMTPConnection.Port     := _serverPort;

      {now we send the message}
      SMTPConnection.Connect;
      try
         SMTPConnection.Send(mailMessage);
      finally
         SMTPConnection.Disconnect;
      end;
  finally
      SMTPConnection.Free;
      mailMessage.Free;
  end;
  Screen.Cursor := crDefault;//mosue normal
end;

Open in new window

CorrectCharacters.jpg
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE