Police in Midlothian are appealing for witnesses following the incident at around 10.45pm on Saturday 7 July in the Dobbie’s Road area.
The 53-year-old victim was within a property when three suspects knocked on his door.
The victim answered and was immediately assaulted, resulting in him sustaining serious head and facial injuries.
Officers were called along with the Scottish Ambulance Service who took the man to the Edinburgh Royal Infirmary for treatment.
The suspects are described as three men, one of whom was described as wearing gloves.
Detective Constable Will Dickson from Dalkeith CID said: “This was an unprovoked attack that has left the victim with serious injuries and we are keen to trace those responsible as soon as possible.
“I am eager to hear from anyone who may have seen three men acting suspiciously in the Dobbie’s Road area on Saturday night, or who witnessed what happened, to come forward to help with our inquiries.
“Anyone with any information relevant to our investigation should contact Dalkeith CID via 101, quoting incident number 5281 of 7 July, or report this anonymously to Crimestoppers on 0800 555 111.”