0

I am new to developing and I have the following task.

I need to be able to able write and retrieve from my database international email addresses, i.e. addresses that contain non-ascii characters like æ, ø, å, ö, ä, ß, ü. In order to do this I need to convert the email address to punycode if I have understood correctly.

Is there an easy way to do this in java?

1 Answers1

1

You don't generally need to convert the address to punycode, no. You definitely can use the human-readable form both when formatting email messages (here's an example of a valid email message, note the ø) and when sending mail.

IDN conversion is necessary in order to perform an MX lookup as part of locating the recipient's mail server, but that task is typically performed by your outgoing mail server. The software you are writing should be able to assume that all the addresses use UTF-8 everywhere, and all the world is simple.

arnt
  • 8,949
  • 5
  • 24
  • 32
  • Interesting blog article. By the way, your autoresponder email address `...@blåbærsyltetøy.gulbrandsen.priv.no` doesn’t work, your server responds with ‘Recipient address rejected: undeliverable address: mail for xn--blbrsyltety-y8ao3x.gulbrandsen.priv.no loops back to myself’ … Check your mail logs. – glts Oct 18 '22 at 16:16
  • @glts I've investigated and I know two ways to prevent that error and perhaps a proper way to fix it. I have to think a bit about what's most proper. What software does mail.gluet.ch run and do you have any idea why it transforms the RCPT TO argument in the way it does? – arnt Oct 19 '22 at 09:04
  • Hm, I didn’t see any transformation? I use standard Postfix 3.4. It’s probably best to continue the conversation via email (I think you should see mine in the log?). – glts Oct 19 '22 at 09:37
  • Something accepted a u-label and emitted an a-label. I'll send you email, but it won't happen today. Many thanks. – arnt Oct 19 '22 at 11:24