Changing sender email display name on force.com sites
I fixed this. The solution is that to create an organization wide email address and set it to all profiles which would work for guest user profile as well. On the code , just call the following
List<OrgWideEmailAddress> lstOrgWideEmailId = [Select id from OrgWideEmailAddress];
if(lstOrgWideEmailId.size() == 0)
{
throw(new PkException('There is no Organization wide email address setup in the org. Please set the organization wide email address'));
}
else
{
orgWideEmailAddressID = lstOrgWideEmailId[0].id;
}
email.setOrgWideEmailAddressId(orgWideEmailAddressID);
This will help to solve issues in future.