I got problem when sending Chinese in email. All Chinese become strange characters in the email.
dim mail as emailMessage
dim content as string = DefineEncoding(TextField.text, Encodings.utf8) //also tried without define encoding
mail.BodyPlainText = content
Anyone can help?
That won’t work because the mail text will interpreted as IsoLatin or similar.
Is it possible to set the ContentType in Xojo emails directly to something like
? Otherwise, you could try to convert your TextField to html and send this instead of plain text.
I tried to append headers for Content-Type, and charset, and tried different charsets, Chinese characters still appears garbage in the email message…
I don’t think that Xojo allows directly editing of content type. Have you tried to convert your text to html and send a html instead of a plain text mail?
Of course, both CURL from the MBS plugin and the Chilkat plugin support more options for sending mails. I just tried with the Chilkat plugin and the chinese text comes across fine.
I’m just testing sending mails anyways. Sending chinese text with Xojo also works - just not with plain text emails.
Beatrix, can you show me how to convert a string to HTML? Sorry, I am still a newbie… Thanks
As far as I can see I’m simply setting both plain text and html version to the same text:
MailToCompany.bodyPlainText = "Name: " + TFName.Text.Trim + EndOfLine.Macintosh + "Email: " + TFEmailAddress.Text.Trim + EndOfLine.Macintosh + EndOfLine.Macintosh + EndOfLine.Macintosh + "Description of Error: " + EndOfLine.Macintosh + TAMessage.Text + EndOfLine.Macintosh + EndOfLine
MailToCompany.BodyHTML = "Name: " + TFName.Text.Trim + EndOfLine.Macintosh + "Email: " + TFEmailAddress.Text.Trim + EndOfLine.Macintosh + EndOfLine.Macintosh + EndOfLine.Macintosh + "Description of Error: " + EndOfLine.Macintosh + TAMessage.Text + EndOfLine.Macintosh + EndOfLine
If this doesn’t work use a html template like this one
/////your mail text here
And replace “/////your mail text here” with your mail text. Then use this as BodyHtml.
As far as I know the send mail class from our plugin works fine with Asian characters.
I have just sent an email to myself using the CURLSMBS plugin with Chinese text pasted in from www.apple.cn and it was received just fine:
Thanks Christian and David, I think this the solution for me. Does this mean that Xojo native does not support the same?
As I wrote a couple of hours ago you need to assign your text to BodyHtml and then chinese text works, too.
With pure Xojo you need to figure out it yourself. With my plugins I made it ready to use for everyone.
The plugin can probably do some details better.