Sample Trigger for Email alert on creation of User:
trigger welcomeUser on User ( after insert ) {
List < Messaging.SingleEmailMessage > mails = newMessaging.SingleEmailMessage();
for ( user u:trigger.new ) {
Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
String[] toAddresses = new String[] { u.Email };
mail.setToAddresses( toAddresses );
mail.setSubject( ‘Welcome’ );
mail.setHtmlBody( ‘<html>Hi ‘ + u.Name + ‘,<br/>Welcome to our Organization’ );
mails.add( mail );
}
Messaging.sendEmail( mails );
}