Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sending UTF-8 emails using CDO2000
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01681865
Message ID:
01682035
Views:
98
> >Because you have national characters in domain name, then smtp adress must use punnycode:

That really shouldn't be necessary. When calling COM objects from FoxPro as the ANSI FoxPro COM Interop APIs automatically convert strings to Unicode. And that should work **as long as the active CodePage supports the characters it's trying to assign**. If the string has values that are not valid for the current CodePage the input is hosed before it ever goes to COM. If you are in a Russian CodePage I don't think the Western Umlauts are valid and if printed would print `?`.

It's hard to say based on the original description that Andrus posted but it sounds to me he's running in a non-Western Code page and trying to send Western characters, which simply won't work unless you switch code pages and convert to binary strings or UTF-8.

+++ Rick ---


>Hmm,
>
>Because you have national characters in domain name, then smtp adress must use punnycode:
>
>DECLARE INTEGER IdnToAscii IN Normaliz.dll   INTEGER,  STRING @,  INTEGER, STRING @, INTEGER
>
>lcsource=STRCONV("test@tööd.com", 5)
>lcDST=REPLICATE(CHR(0), 50)
>lii=IdnToAscii(4, @lcsource, LEN(lcsource)/2, @lcDST, LEN(lcDST))
>?STRCONV(LEFT(lcDST, m.lii*2),6)
>
>
>MartinaJ
>
>>Hi,
>>
>>Yes. Receiver domain name contains öö charaters:
>>
>>https://xn--pvckatusetd-0fba.ee/
>>
>>How to pass this as receiver domain name from FoxPro application to send e-mail?
>>I expected that CDO encodes receiver e--mail properly if it is passed in UTF-8 but it looks like this does not happen.
>>
>>Posted also in
>>https://stackoverflow.com/questions/68672775/how-to-send-e-mail-if-receiver-domain-name-contains-unicode-characters
>>
>>Andrus.
>>
>>>
>>>Hmm, you need UTF-8 in smtp address (xnxaxmxex)?
>>>Not it's the same such as UTF-8 in body or HTML body.
>>>
>>>
>>>MartinaJ
>>>
>>>
>>>>For cyrillic message body I "resolved" the issue by using latin characters instead of russian ones.
>>>>
>>>>Some receiver e-mail addresses contain unicode characters like
>>>>
>>>>test@tööd.com
>>>>
>>>>Trying to use CDO2000 to send to those addresses throws error
>>>>
>>>>ERROR: :1429 # send # 213 # 0x0000020F The server rejected one or more recipient addresses. The server response was: 501 5.1.3 Bad recipient address syntax
>>>>
>>>>I tried
>>>>
>>>>
EXTERNAL PROCEDURE cdo2000.prg
>>>>loMail = NEWOBJECT("Cdo2000", "Cdo2000.fxp")
>>>>WITH loMail
>>>>	SYS(3101 ,65001)
>>>>	.cTo = strconv(cRecipients,9,  1257, 1 )
>>>>...
>>>>
>>>>
>>>>But bad recipient address error still occurss. I also tried
>>>>
>>>> .cCharset = 'UTF-8'
>>>>
>>>>and in cdo2000.prg added comprop
>>>>
>>>> WITH This
>>>> .ClearErrors()
>>>> .oCfg = CREATEOBJECT("CDO.Configuration")
>>>>// Added
>>>> COMPROP(.oCfg, "UTF8",1)
>>>> .oMsg = CREATEOBJECT("CDO.Message")
>>>>// Added
>>>> COMPROP(.oMsg, "UTF8",1)
>>>> .oMsg.Configuration = This.oCfg
>>>> ENDWITH
>>>>
>>>>but problem persists.
>>>>I also tried blat.dll to send email this this also throws error.
>>>>
>>>>How to send e-mail to address test@tööd.com from FoxPro ?
>>>>
>>>>Mozilla Thunderbird send e-mail to this address without issues.
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform