The 31-year-old, who initially left the Hammers in 2013 before re-signing five months later, scored 68 goals in 293 appearances after first joining from Chelsea in 2006.
Goalkeeper Jussi Jaaskelainen, 40, defender Guy Demel, 33, and midfielder Nene, 33, have also not been retained.
"It means a lot to me to have been at West Ham for so long," said Cole.
"I wouldn't like to use the word hero, but I have played my part.
"A load of players have come and gone, but I've stayed around and enjoyed every minute of it."
Development players Kieran Bywater, Sean Maguire, Paul McCallum, Taylor Tombides and Dan Potts will also leave the club.
Striker Carlton Cole will leave West Ham this summer when his contract expires on 30 June.