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 = ('userid@gmail.com').val(); var password = (‘secret’).val();
var url = ‘https://foo.com/api/v2/db/_table

$.ajax({
url: url,
async: true,
type:‘GET’,
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?

Thanks,
@AlexBowen