How to verify Users Account by sending email confirmation?

I want to verify Users Account by sending email confirmation .

The email must contains the Username and Password. Which he/she entered at registration time.
After that, email sent to it’s registered Id which contains the logins details and also a Link for verifying the account . By clicking on Link Users account verified.

I am facing problems while doing this activities.
Like, i created a Registration Template and apply Validation constraint i.e.

var username = var username = ('').val(); var password = (‘secret’).val();
var url = ‘

url: url,
async: true,
dataType: ‘json’,
contentType: ‘application/json’,
beforeSend: function(xhr) {
xhr.setRequestHeader(“Authorization”, "Basic "+btoa(username+’:’+password));
success: function(json){

error: function(err) {


And, while sending email from email service, I am getting “message”: “Executed command returned with error code: 127”.

Help !

Hey @aamir_rais,

Have you checked out a few of our resources on our Wiki?