电子邮件迁移和多域帐户

时间:2013-09-09 13:20:33

标签: python google-admin-sdk

我正在使用Google data Python client library将电子邮件导入我的用户帐户。

如果这对主域中的用户工作正常,我会在单独的域中收到错误。

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")

因此,如果我将domain设置为主要版本,那么当我尝试提交批处理时,会收到以下错误消息:

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.'}

如果我没有设置域名,我会改为使用这个域名:

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.'}

我可以理解为什么会出现这些错误,但问题是:我可以在单独的域中导入用户的电子邮件吗?如果是这样,怎么样?

1 个答案:

答案 0 :(得分:0)

首先,你真的应该使用new Email Migration APIgoogle-api-python-client而不是old and deprecated GData-based API

话虽如此,它应该只是将域值设置为您希望将邮件迁移到用户邮箱而不是管理域的问题:

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

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