Cole posted several messages on Twitter on Tuesday appearing to indicate he had no future at the club he joined in July 2006 from London rivals Chelsea and the Hammers confirmed on Wednesday morning that his contract would not be renewed.
"Carlton's contract has come to an end and we have decided not to renew that contract," Sam Allardyce said.
"Carlton's need at his age is to be playing football as often as he can. From our point of view we felt it better that he found pastures new.
"We can only thank him for his outstanding commitment and service to West Ham United over the last seven years."
Cole scored 59 times in 237 appearances for the east London side and was a key part of the side that achieved promotion from the npower Championship a year ago with 15 goals, including the opener in the play-off final victory over Blackpool at Wembley.
"Life is filled with ups & downs today is adown but I'll be back! Carlton Cole/CFC as I have been called has left the building #UNDERCHUFFED," he wrote on Twitter.
"I want to thank the West Ham fans for their support especially the 1's who made the away games feel like a home 1 #COYI.
"I came to East London not knowing what to expect but I'm glad i did the last 7 years I've met a lot of good honest decent people #THANKYOU."
His departure will leave Allardyce, who made Romania captain Razvan Rat his first signing of the summer, scrambling for attacking reinforcements. The Hammers are reported to have agreed a fee with Liverpool for England striker Andy Carroll, who made an impression on Allardyce after a successful season-long loan at Upton Park, and the final decision now lies with the 24-year-old.