To do this you must first set up a dedicated email address by navigating to Setup -> Administration Setup -> Email Administration -> Organization-Wide Addresses menu.
Setup the address(say :[email protected]) and need to verify for the use.
Add the below code :
OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = '[email protected]'];
Messaging.SingleEmailMessage EmailMessage = new Messaging.SingleEmailMessage();
if ( owea.size() > 0 ) {
EmailMessage.setOrgWideEmailAddressId(owea.get(0).Id);
}
EmailMessage.setTargetObjectId(opp.Applicant_Student_Record__c);
EmailMessage.setTemplateId(et.Id);
EmailMessage.setWhatId(opp.Id);
EmailMessage.setSaveAsActivity(false);
EmailMessage.setReplyTo('[email protected]');
EmailMessage.setSenderDisplayName('Development');
EmailMessage.setFileAttachments(Attachment);
emails.add(EmailMessage);
Here setting up the email address at "Email Administration" will help you to set the desired mail address from whom you want to send the mail( form which you are also querying from "OrgWideEmailAddress" to get the particular one if in case you have multiple address setup).