Searching Salesforce Records in Visualforce

This example gets an input from the user on the visualforce page. When you click search it passes the query into the function in the controller which uses Database.query().   Visualforce:

Apex:

 

Sending Email Notifications to Assigned User on Task Creation

If you would like to send an email notification to the owner of a task when its created. Using a trigger on the task object before insert you can invoke Messaging.SingleEmailMessage. Below is a code example. Trigger: