Email username and password after creating a new user

You can share your Lua Scripts with everybody here.

Email username and password after creating a new user

Postby FTP » Tue Sep 27, 2016 6:03 pm

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".
FTP
Site Admin
 
1876
 
Tue Sep 29, 2009 6:09 am

Re: Email username and password after creating a new user

Postby impact » Fri Sep 30, 2016 10:19 am

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
impact
 
19
 
Fri May 10, 2013 1:39 pm

Re: Email username and password after creating a new user

Postby JohnCooper » Thu Dec 15, 2016 12:01 pm

What do I need to add that this email gets only sent when the field is not empty or will it do that anyways?
JohnCooper
 
1
 
Thu Oct 20, 2011 10:53 pm

Re: Email username and password after creating a new user

Postby FTP » Thu Dec 15, 2016 1:39 pm

Do you mean the "note_email" field? If it is empty, of course you can't send the email successfully.
FTP
Site Admin
 
1876
 
Tue Sep 29, 2009 6:09 am

Re: Email username and password after creating a new user

Postby danipapi » Thu Feb 09, 2017 10:48 pm

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
danipapi
 
3
 
Thu Feb 09, 2017 10:35 pm

Re: Email username and password after creating a new user

Postby FTP » Thu Feb 23, 2017 4:29 am

Yes, the Lua API "c_SendMail" can be used by the system admin only.
FTP
Site Admin
 
1876
 
Tue Sep 29, 2009 6:09 am


Return to Lua scripts

Who is online

Users browsing this forum: No registered users and 2 guests

cron