# 5. `VirtualMailManager.Relocated` — Handling of relocated users

This module provides the `Relocated` class. The data are read from/stored in the `relocated` table. An optional lookup table, used by Postfix for the “`user has moved to new_location`” reject/bounce message.

## 5.1. Relocated

class VirtualMailManager.Relocated.Relocated(dbh, address)

  Creates a new Relocated instance. If the relocated user with the given address is already stored in the database use `get_info()` to get the destination address of the relocated user. To set or update the destination of the relocated user use `set_destination()`. Use `delete()` in order to delete the relocated user from the database.

  Parameters:

    - dbh (`pyPgSQL.PgSQL.Connection`) – a database connection

    - address (`VirtualMailManager.EmailAddress.EmailAddress`) – the e-mail address of the relocated user.

  delete()
    Return type:

      `None`

    Raises:

      VirtualMailManager.errors.RelocatedError – if the relocated user doesn’t exist.

    Deletes the relocated user from the database.

  get_info()
    Return type:

      `VirtualMailManager.EmailAddress.EmailAddress`

    Raises:

      VirtualMailManager.errors.RelocatedError – if the relocated user doesn’t exist.

    Returns the destination e-mail address of the relocated user.

  set_destination(destination)
    Parameters:

      destination (`VirtualMailManager.EmailAddress.EmailAddress`) – the new address where the relocated user has moved to

    Return type:

      `None`

    Raises:

      VirtualMailManager.errors.RelocatedError – if the destination address is already saved or is the same as the relocated user’s address.

    Sets or updates the destination address of the relocated user.