1

I'm creating a forwarding address for my Gmail account with Gmail API. I know that if function

service.users().settings().forwardingAddresses().create(userId='me', body=address).execute()

returns a result with a verificationStatus of pending, the recipient has to verify the email with a link or a verification code.

I can enter the verification code here in Gmail Settings>Forwarding , but is there a way where I can enter the verification code with the Gmail API?

Rafa Guillermo
  • 14,474
  • 3
  • 18
  • 54
Andrea
  • 141
  • 1
  • 8
  • 1
    Please [edit](http://stackoverflow.com/posts/56048196/edit) the question to be on-topic: include a [Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) that duplicates the problem. Questions seeking debugging help ("why isn't this code working the way I want?") must include: (1) the desired behavior, (2) a specific problem or error and (3) the shortest code necessary to reproduce it in the question itself. Please also see: [What topics can I ask about here?](http://stackoverflow.com/help/on-topic), and [How to Ask](http://stackoverflow.com/help/how-to-ask) – MαπμQμαπkγVπ.0 May 09 '19 at 06:50

1 Answers1

0

According to the Gmail API documentation, if Gmail requires verification for a forwarding address, a verification message is sent to the target email address and returned status is 'pending'. The owner of the target email address must complete the verification process before it can be used.

Unfortunately, the Gmail API does not have a verify method for forwarding addresses. The list of methods and paramaters for the Users.settings.forwardingAddresses method can be found here where it details that on call of forwardingAddresses.create(args):

"...if ownership verification is required, a message will be sent to the recipient and the resource's verification status will be set to pending; otherwise, the resource will be created with verification status set to accepted.

Rafa Guillermo
  • 14,474
  • 3
  • 18
  • 54