An investigation is underway after an Auckland college student hacked into the school's database and sent pornographic images to all students.
Radio New Zealand reported that a student at Mount Albert Grammar school created a fake Gmail account, hacked into the school's email database and sent pornographic images to all 2700 students.
The email address was then deactivated.
Mount Albert Grammar school headmaster Dale Burden said the database was immediately closed down after parents notified the school.
NetSafe executive director Martin Cocker said email database hacking happened from time to time.
"School networks are more vulnerable to an insider attack. It's a challenge for schools to face," he said.
He said it was a serious offence to unlawfully access a computer network.