Author Topic: How to change way how e-mail address for new user is created  (Read 3727 times)

Offline happymaster23

  • Newbie
  • *
  • Posts: 3
How to change way how e-mail address for new user is created
« on: January 08, 2012, 08:22:55 PM »
Hello,

IMAP/SMTP usernames on my server are in form user_domain.tld. When
this user first time log in to RoundCube, new identy for him is
created with default e-mail adress in form user_domain.tld@localhost,
which is unfortunately not accepted by SMTP server (because this user
does not exist). So my question is, if there is any way to change this
behavior (just pick IMAP username and substitute _ by @).

Thank you very much for your help.

Martin

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
How to change way how e-mail address for new user is created
« Reply #1 on: January 08, 2012, 09:54:37 PM »
Just set $rcmail_config['username_domain'] to the domain in /config/main.inc.php.

Offline oldschool

  • Sr. Member
  • ****
  • Posts: 406
How to change way how e-mail address for new user is created
« Reply #2 on: January 08, 2012, 09:55:43 PM »
It depends on your rc config and your mail server.

Most mail servers work with aliases.
So the server knows "user" is "user@domain.tld".

Take a look at your mail server how it handles this.




Rgds.

Offline happymaster23

  • Newbie
  • *
  • Posts: 3
How to change way how e-mail address for new user is created
« Reply #3 on: January 09, 2012, 06:56:11 AM »
skaero: Thank you for your reply. I think, that this did not help, because with this change e-mail addresses will be in form username_domain.tld@, am I right? Additionally, my server is handling multiple domains.

oldschool: Thank you for your reply too. My server is configured to accept all localhost relaying (without authentication), but e-mail address in FROM must exist in its database, so e-mail addresses must be in correct form, otherwise MTA will refuse to handle it. I think, that this is the correct behaviour.

I really need to overwrite IMAP login which is in form username_domain.tld to username@domain.tld. I am able to write some PHP code that will make this overwrite thing, but writing whole plugin (using hooks and etc) is out of my universe. So if there is someone who was so kind and write skeleton of plugin that will bypass creating new user, it would be very grateful. Or is there any other way to do this?

Thank you very much

Offline oldschool

  • Sr. Member
  • ****
  • Posts: 406
How to change way how e-mail address for new user is created
« Reply #4 on: January 09, 2012, 01:08:19 PM »
Hi!

Take a look at the rc sql database.
There's an alias for each user.
Maybe it could help you...



Rgds.

Offline happymaster23

  • Newbie
  • *
  • Posts: 3
How to change way how e-mail address for new user is created
« Reply #5 on: January 09, 2012, 02:09:10 PM »
oldschool: Yes, I can change e-mail address directly in database, but it have to be done via external script or manually and this solution is not very clean...

Offline oldschool

  • Sr. Member
  • ****
  • Posts: 406
How to change way how e-mail address for new user is created
« Reply #6 on: January 09, 2012, 04:44:36 PM »
It is very difficult to help when the running system is unknown...

Take a look at the "virtuser_file"-plugin.
I use it, too.



Rgds.

Offline SKaero

  • Administrator
  • Hero Member
  • *****
  • Posts: 5,879
    • SKaero - Custom Roundcube development
How to change way how e-mail address for new user is created
« Reply #7 on: January 11, 2012, 01:41:46 PM »
You can set $rcmail_config['username_domain'] with the following options:
%h - user's IMAP hostname
%n - http hostname ($_SERVER['SERVER_NAME'])
%d - domain (http hostname without the first part)
%z - IMAP domain (IMAP hostname without the first part)