Here is to code to send email using salesforce apex when new contact record is get created.
List emailList = new List();
Messaging.SingleEmailMessage emailTemplate = new Messaging.SingleEmailMessage();
List lstNewContact = [Select Name, Email From Contact where Id =: Trigger.new ];
for(Contact contact : lstNewContact) {
emailTemplate.setToAddresses(new String[] {contact.Email});
emailTemplate.setSubject('New contact record created');
emailTemplate.setHtmlBody('Hello team, new contact is added Name: '+ contact.Name);
emailList.add(emailTemplate);
Messaging.sendEmail(emailList );
}
}
We have explained the same in this video.