0

I'm using the Google data Python client library to import emails into my users account.

If this is working fine for users in the primary domain, I get an error for users in a separate domain.

from gdata.apps.migration import service

user  = "user@example.fr"
admin = "admin@example.com"
admin_pwd = "hackme"

srv = service.MigrationService(email = admin, password = admin_pwd, domain = "example.com")

So if I set domain to the primary one, I get the following error message when I try to submit the batch:

gdata.apps.service.AppsForYourDomainException: {'status': 403, 'body': '<HTML>\n<HEAD>\n<TITLE>Authorization failed.  Ensure that the destination user exists and try again.</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Authorization failed.  Ensure that the destination user exists and try again.</H1>\n<H2>Error 403</H2>\n</BODY>\n</HTML>\n', 'reason': 'Authorization failed.  Ensure that the destination user exists and try again.'}

If I set no domain name, I get this one instead:

gdata.apps.service.AppsForYourDomainException: {'status': 403, 'body': '<HTML>\n<HEAD>\n<TITLE>Invalid domain.</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Invalid domain.</H1>\n<H2>Error 403</H2>\n</BODY>\n</HTML>\n', 'reason': 'Invalid domain.'}

I can understand why I get those errors but the question is: can I import users emails on a separate domain? If so, how?

Spack
  • 464
  • 4
  • 22

1 Answers1

0

First off, you really should be using the new Email Migration API along with the google-api-python-client for this rather than the old and deprecated GData-based API.

Having said that, it should just be a matter of setting the domain value to that of the user mailbox you wisht to migrate mail into rather than the admin domain:

user  = "user@example.fr"
admin = "admin@example.com"
admin_pwd = "hackme"

srv = service.MigrationService(email = admin, password = admin_pwd, domain = "example.fr")
Jay Lee
  • 13,415
  • 3
  • 28
  • 59
  • I don't quite understand how to migrate emails using the new API but anyway it works if I set `domain` to the user's domain and then use only the user key when submitting. – Spack Sep 10 '13 at 08:44
  • Feel free to post a new question covering your issues using the new API and post the link here, I'll do my best to answer them also. – Jay Lee Sep 10 '13 at 12:27