Email username and password after creating a new user

You can share your Lua Scripts with everybody here.
Post Reply
FTP
Site Admin
Posts: 1918
Joined: Tue Sep 29, 2009 6:09 am

Email username and password after creating a new user

Post by FTP »

If you want to email USER/PASS after creating a new user, then you can modify the file "webadmin/admin_adduser.html", find this line: AddUser(domain,user)

And insert the following line below it:

c_SendMail(user.note_email,"Your account name and password","Your account name and password<br>Username: "..user.username.."<br>Password: "..user.password,"","SMTP_CONFIG")

Here, user.note_email is the email address defined at "User -> Notes -> Email address", SMTP_CONFIG is the SMTP configuration name, you can add a SMTP configuration at "Server > Settings > SMTP Manager".

And if you want to force user changing his password, just check on this option "Domain > Settings > General Settings > Password & Security > Need to change the password on the first logon".
impact
Posts: 19
Joined: Fri May 10, 2013 1:39 pm

Re: Email username and password after creating a new user

Post by impact »

About forcing password change is it possible to choose it at user and not and domani level?
We have different kind of users some of which need to change password and other who must not change it.

Thank you
JohnCooper
Posts: 1
Joined: Thu Oct 20, 2011 10:53 pm

Re: Email username and password after creating a new user

Post by JohnCooper »

What do I need to add that this email gets only sent when the field is not empty or will it do that anyways?
FTP
Site Admin
Posts: 1918
Joined: Tue Sep 29, 2009 6:09 am

Re: Email username and password after creating a new user

Post by FTP »

Do you mean the "note_email" field? If it is empty, of course you can't send the email successfully.
danipapi
Posts: 3
Joined: Thu Feb 09, 2017 10:35 pm

Re: Email username and password after creating a new user

Post by danipapi »

First, you need to add the c_SendMail function before the AddUser function to not send md5 password to your user.

The c_SendMail function seems to work only when connected as main Admin, when it is an admin limited to some domains, it is not working. No email was sent.

Do you know why ?

Regards 1
FTP
Site Admin
Posts: 1918
Joined: Tue Sep 29, 2009 6:09 am

Re: Email username and password after creating a new user

Post by FTP »

Yes, the Lua API "c_SendMail" can be used by the system admin only.
Post Reply