Judge Rea told Coles that even if the prison sentence was calculated at less than two years, he would not have considered home detention as an alternative.
"This was planned, you essentially groomed this boy," Judge Rea said, adding later: "The message needs to be brought home that there is a cost for that behaviour".
Outside the court, the boy's mother supported the sentence, and publication of the offender's name, for which there was no suppression.
She told Hawke's Bay Today: "It is really important the community know of him and his offending so we can all protect our children."
The court was told Coles and the boy had come into contact via a website, and that on March 31 Coles asked the boy to connect via text message.
Coles asked how old the boy was and was told "14, nearly 15" and the arrangement was made to meet.
Judge Rea said that whatever the boy's age, Coles knew it was under 16.
"What you did therefore was predatory behaviour against a child," Judge Rea said.
It was the second case of its type in the Napier District Court this year, a 34-year-old man having been sentenced in August to two years and three months in jail.
* An earlier version of this article incorrectly stated Coles was living with his wife and children at the time of the offending. The error is regretted.