Problem on setting an email account for users (always invalid)

Steps to reproduce

  1. Add user profile email account and click Set Email
  2. Any written email account will get en error "Invalid mail address"

Server configuration

Centos 6.9

Apache PHP5.6 with PHP-FPM

MariaDB 10.1

ownCloud 10.0.6 (stable)

Fresh install from


do you have a local installation or a docker installation or a installation on a hosted environment?

Edit: I just tested it and could not reproduce your issue. can you say more to your installation, the exact process that causes the error and the email address you are entering?

This is a hosting environment (cPanel) but our own VPS with Centos.

About installation, downloaded the package from and it went through without problems.
I will login with username and password -> Settings -> Type in email address -> Set email -> Error message Invalid mail address

This occurs with any kind of email address that will be typed in.

Could you try to reinstall ownCloud via tar balls and see if the problem still persists?

Edit: could you post an example of a email address that is being invalid?

Is there any update on this? I have the same issue. Error log is showing the following errors:

   > {"reqId":"Wo3dYFwX01oyGrQ3GttIngAAAHE","level":3,"time":"2018-02-21T20:58:08+00:00","remoteAddr":"","user":"MyName","app":"PHP","method":"PUT","url":"\/index.php\/settings\/users\/myname\/mailAddress","message":"Use of undefined constant INTL_IDNA_VARIANT_UTS46 - assumed 'INTL_IDNA_VARIANT_UTS46' at \/home\/olivetreestudios\/cloud\/lib\/private\/Mail\/Mailer.php#135"}
    > {"reqId":"Wo3dYFwX01oyGrQ3GttIngAAAHE","level":3,"time":"2018-02-21T20:58:08+00:00","remoteAddr":"","user":"MyName","app":"PHP","method":"PUT","url":"\/index.php\/settings\/users\/MyName\/mailAddress","message":"idn_to_ascii() expects parameter 3 to be long, string given at \/home\/olivetreestudios\/cloud\/lib\/private\/Mail\/Mailer.php#135"}

Everything else works well.

Is your ownCloud hosted too?

Unfortunately I'm pretty new to this business and the language sometimes is "over my head". If what you mean by being hosted is - do I have it on a remote server? Yes. I have it set up as a subdomain to our business website. will take you to the login page.
I changed the $domain = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_UTS46); to $domain = idn_to_ascii($domain, 0, INTL_IDNA_VARIANT_2003); (edited to add that this is in the /lib/private/Mail/Mailer.php)
It now saved the email address.

Edited to add that if anyone else has this problem: Once you make the above changes to the Mailer.php file mentioned above - you will also make the same UTS46 to 2003 change in the /lib/private/Mail/Message.php in order to send mail.

As I mentioned: I'm new to this and maybe this is not a good solution.


Just a note to acknowledge the multiple edits in the above post.

burlyn84, thanks for taking the time to post that fix. This issue has been around for a while -

This info really should be placed in the email configuration section of the ownCloud Server Administration Manual because the issue is related to the deprecation of INTL_IDNA_VARIANT_2003 in PHP 7.2. The problem is a lot of cPanel dedicated VMs are still on PHP 5.6.3x because cPanel was slow to support the 7 series.

I will see that this will be documented


You can also fix the error by uploading these two files from previous OwnCloud version 9.1.7.


1 Like

Thanks, this fixed the problem.

It works. Thanks for the solution. :grinning::+1:

How about in a shared server? I have the same issue Invalid email