EscapeIdnDomain Method


Encodes specified text string (e-mail address) to allow using international characters in domain name.

Use this method to convert domain part of e-mail address into Punycode. If the e-mail address does not have international characters, it will be left intact. Can be used for From, To, CC, etc.

As an e-mail address can also contain friendly name, be sure to apply this method only to the e-mail address itself. You can append friendly name later (like it's done in the sample code below).


strEscapedAddress = ObjectName.EscapeIdnDomain(EmailAddress)  
Parameters:  
EmailAddress As String E-mail address whose domain part to encode (like "user@domain").  
Return value As String E-mail address with Punycode-encoded domain part, or the source string if such encoding is not needed.  
Remarks: If you need to encode multiple addresses, you need to encode each address separately and concatenate the results then.

Usage example:

Dim Mailer, strFilename
'Using visual basic to create object
Set Mailer = CreateObject("MailBee.SMTP")
'Using ASP to create object
'Set Mailer = Server.CreateObject("MailBee.SMTP")
'In ASP use Response.Write instead of MsgBox
Mailer.LicenseKey = "put your license key here"
Mailer.ServerName = "mail.server.com"
If Mailer.Connect Then
  Mailer.Message.ToAddr = "bill@yoursite.com"
  Mailer.Message.FromAddr = "Alex <" & Mailer.Message.EscapeIdnDomain("alex@почта.рф") & ">"
  Mailer.Message.Subject = "Hello, There is word 'pochta.rf' written in Russian in 'From' domain part"
  Mailer.Send
  Mailer.Disconnect
End If

See Also:

UnescapeIdnDomain Method
FromAddr Property
ToAddr Property


Copyright © 2002-2024, AfterLogic Corporation. All rights reserved.