Added function for sending post and sending error email