Go to Admin > Workflows > Automations > New rule under the Ticket updates tab.

Sample rule:

When an action performed by: 

Agent or Requester

Involves any of the following events:

Status is changed from Any Status to Resolved 

Status is changed from Any Status to Closed

On tickets with these properties: 

if Source > is any of > Portal


Send email to requester (configure your email)