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


#1

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 www.owncloud.org


Error Creating User - Invalid Mail Address
#2

Hi,

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?


#3

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

About installation, downloaded the package from owncloud.org 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.


#4

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?


#5

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":"108.162.221.74","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":"108.162.221.74","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.


#6

Is your ownCloud hosted too?


#7

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. cloud.olivetreestudios.com 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.


#8

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


#9

burlyn84, thanks for taking the time to post that fix. This issue has been around for a while - https://central.owncloud.org/t/incorrect-e-mail-oc-9-0-9-1/6745.

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.


#10

I will see that this will be documented

Thanks


#11

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

lib/private/Mail/Mailer.php
lib/private/Mail/Mail.php


Invalid mail address. For password recovery and notifications
#12

Thanks, this fixed the problem.


#13

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


#14

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