0

I am able to get a GDEntry object using RetrieveForwarding in the gdata.apps.emailsettings.client.EmailSettingsClient class.

I am able to see which XML objects contain the "ForwardTo" address in this object using Regex or an XML module. An example output includes (among others) the following lines:

<ns0:property xmlns:ns0="http://schemas.google.com/apps/2006" name="enable" value="true" />
<ns0:property xmlns:ns0="http://schemas.google.com/apps/2006" name="action" value="KEEP" />
<ns0:property xmlns:ns0="http://schemas.google.com/apps/2006" name="forwardTo" value="name@email.com" />

Now that I have each of the forwardTo addresses, I want to delete them. I do not want to simple disable forwarding. When looking at my options, the only method I see that can be called which is relevant is the UpdateForwarding in gdata.apps.emailsettings.client.EmailSettingsClient. However, as you can see this method doesn't allow me to delete a forwardTo address.

update_forwarding(self, username, enable, forward_to=None, action=None, **kwargs)
    Update Google Mail Forwarding settings.

    Args:
      username: string The name of the user.
      enable: Boolean Whether to enable incoming email forwarding.
      forward_to: (optional) string The address email will be forwarded to.
      action: string (optional) The action to perform after forwarding
              an email (ACTION_KEEP, ACTION_ARCHIVE, ACTION_DELETE).
      kwargs: The other parameters to pass to the update method.

The goal is to remove an existing forwarding address. These accounts move from one person to another and I am trying to create a seamless transition. This includes removing old forwarding addresses, something which at the moment must be done manually by logging into each account.

Michael
  • 309
  • 2
  • 3
  • 16

1 Answers1

1

As you have noticed, there is no method to delete the forwarding address completely. If forwarding is disabled, then Retrieve Forwarding Settings calls return nothing for the email address:

https://developers.google.com/google-apps/email-settings/#retrieving_forwarding_settings

however the email address is still visible in the Gmail Settings UI and can only be deleted from there.

If you do not want users to know their emails are being forwarded/monitored, you may need to make use of either the Google Apps Email Audit API Monitors or Google Vault.

Jay Lee
  • 13,415
  • 3
  • 28
  • 59
  • The application is for email addresses that transfer from one person to another. The idea is to make this transition seamless, including the removal of any old "forwarding" addresses. Thanks for your input. I suppose I will just disable it for now. – Michael Dec 29 '12 at 23:19