Use case:
Send different email to a lead based on the lead source.

My first impression on what the solution would be:
First off, it i pretty simple to create a workflow with number of action equal to number of lead source picklist values. However, this doesn’t work if the number of picklist values go more than 10. (refer to limits on workflow actions here)

The better solution:
So the solution is to head to Visualforce email template and render the email subject and body based on the lead source field value.

Here is what the template looks like:

<messaging:emailTemplate subject="{!IF(relatedTo.LeadSource = 'Web','This is PG1 subject', IF(relatedTo.LeadSource = 'Other','This is PG2 subject','false') )}"  recipientType="Lead" relatedToType="Lead">


IF(relatedTo.LeadSource = "Web","This is PG1 email"
IF(relatedTo.LeadSource = "Other","This is PG2 email ","false")



Any ideas? Can it get any better? Do leave your comments,