We would like to submit a form in email created with AMP4EMAIL to Google Maps Static API and retrieve an image to be displayed in the email according to the form submission.
How can CORS requirement be met for using the API inside AMP email?
There will be more troubles than just not meeting the AMP for Email CORS requirement.
AMP for Email in general doesn't work very well with most public RESTful APIs like the Google Maps API. Public RESTful APIs usually require the following:
GET
and POST
None of that is possible in AMP for Email.
On the other hand, public APIs won't respond with the right response headers that meet the AMP CORS requirements.
The best you can do is to have your own proper XHR endpoint that meets the AMP for Email CORS requirement and proxies the call to the Google Maps API on the server side:
AMP email -> your AMP for Email XHR endpoint -> Google Maps API