Recent

Author Topic: LNET sendmail UTF8  (Read 11199 times)

vexal

  • New Member
  • *
  • Posts: 29
LNET sendmail UTF8
« on: September 12, 2011, 03:38:20 pm »
Hi,

When i am sending mail with accent (i'm french) with the sendmail method of lsmtp, i am receiving mail in wrong encoding.
For example, if i send
Quote
Test éaà@rzùkt&gùlv*
i will receive
Quote
Test éaà @rzùkt&gùlv*
.
I am under CentOs 6 Linux with Lazarus 0.9.30 and lnet 0.6.5
What did i need to do ?

felipemdc

  • Administrator
  • Hero Member
  • *
  • Posts: 3538
Re: LNET sendmail UTF8
« Reply #1 on: September 12, 2011, 03:58:53 pm »
What about some sample code?

vexal

  • New Member
  • *
  • Posts: 29
Re: LNET sendmail UTF8
« Reply #2 on: September 12, 2011, 04:19:10 pm »
Of course :

Code: [Select]
SMTPClient.SendMail('test1@example.com', 'test2@example.com', 'test', 'Test éaà@rzùkt&gùlv*');

Arbee

  • Full Member
  • ***
  • Posts: 223
Re: LNET sendmail UTF8
« Reply #3 on: September 12, 2011, 04:19:50 pm »
The second piece of text I recognize as UTF-8 characters, displayed as if it is ASCII text, in which case you see the separate characters (bytes) which make up each UTF-8 character.  For instance the é character occupies two bytes when viewed separately as ASCII come out as é.

So it looks like your email is sent as UTF8 alright. 



1.0/2.6.0  XP SP3 & OS X 10.6.8

vexal

  • New Member
  • *
  • Posts: 29
Re: LNET sendmail UTF8
« Reply #4 on: September 12, 2011, 04:24:24 pm »
I just test this under windows and i have no problem.
Even if i try
Code: [Select]
SMTPClient.SendMail('test1@example.com', 'test2@example.com', 'test', Utf8ToAnsi('Test éaà@rzùkt&gùlv*')); i have a problem under linux.

Arbee

  • Full Member
  • ***
  • Posts: 223
Re: LNET sendmail UTF8
« Reply #5 on: September 12, 2011, 04:29:39 pm »
utf8toSys does not work either?
1.0/2.6.0  XP SP3 & OS X 10.6.8

vexal

  • New Member
  • *
  • Posts: 29
Re: LNET sendmail UTF8
« Reply #6 on: September 12, 2011, 04:33:20 pm »
nope, the same  :'(

Arbee

  • Full Member
  • ***
  • Posts: 223
Re: LNET sendmail UTF8
« Reply #7 on: September 12, 2011, 04:58:26 pm »
By the way ... what are you receiving the email with?   Is that a separate application and is that Unicode enabled? (I'm not a Linux expert as you may gather)
1.0/2.6.0  XP SP3 & OS X 10.6.8

vexal

  • New Member
  • *
  • Posts: 29
Re: LNET sendmail UTF8
« Reply #8 on: September 12, 2011, 05:02:26 pm »
I am receiving email in Thunderbird under windows. It can display correctly utf8 messages, usually.
I tried with a webmail under linux but the same than in thunderbird : UT8 is not decoded.

Arbee

  • Full Member
  • ***
  • Posts: 223
Re: LNET sendmail UTF8
« Reply #9 on: September 12, 2011, 05:26:15 pm »
OK, you can't set the browser to show UTF8?  If not, I guess it all boils down to not sending the email as UTF8, if I understand you correctly.  If UTF8ToAnsi nor UTF8ToSys works, then I'm afraid I must hand this over to a Linux FPC-er.
1.0/2.6.0  XP SP3 & OS X 10.6.8

vexal

  • New Member
  • *
  • Posts: 29
Re: LNET sendmail UTF8
« Reply #10 on: September 12, 2011, 05:29:06 pm »
I guess it all boils down to not sending the email as UTF8

I am afraid you are rigth. Thank you anyway !

Almindor

  • Sr. Member
  • ****
  • Posts: 412
    • http://www.astarot.tk
Re: LNET sendmail UTF8
« Reply #11 on: September 13, 2011, 06:04:55 pm »
You need to ensure that the receiving application expects UTF-8. SMTP doesn't handle encoding itself, it just sends what's fed to it. But you should use mimetypes to specify that your e-mail is UTF-8. I'm a bit short on time atm. to look it up but it's all about the mimetype header in the mail body.

vexal

  • New Member
  • *
  • Posts: 29
Re: LNET sendmail UTF8
« Reply #12 on: September 13, 2011, 06:37:21 pm »
Ok, Thank you !  :)
I will look at this tomorow

vexal

  • New Member
  • *
  • Posts: 29
Re: LNET sendmail UTF8
« Reply #13 on: September 14, 2011, 11:45:32 am »
Hi, you were rigth !

I modified line 772 in lsmtp like this and it works :
Code: [Select]
Data('Content-type: text/plain; charset=UTF-8' + CRLF + 'From: ' + From + CRLF + 'Subject: ' + Subject + CRLF + 'To: ' + FSL.CommaText + CRLF + CRLF + Msg);
But this is not very clean. i prefer to not modify the library.
Do you know how i can add the header without modifying the lib ?



 

TinyPortal © 2005-2018