Mails i am sending to the gmail api end point have the following header which marks them as dangerous(I’ve tested sending mails manually with the exact same content and this is the only difference i found between them):
Received: from 690102201862 named unknown by gmailapi.google.com with HTTPREST
I have a server handling mail on an EC2 instance for which i’ve configured reverse DNS on its elastic IP, as recommended by similair solutions to this issue.
The mail is being dispatched using the following python snippet as specified by the gmail API docs.
msg = EmailMessage()
msg['From'] = formataddr((mail_id.display_name, mail_id.email))
msg['To'] = queued_mail.to
msg['Subject'] = queued_mail.subject
msg.set_content(queued_mail.html_message, subtype='html')
encoded_message = base64.urlsafe_b64encode(msg.as_bytes()).decode()
create_message = {
'raw': encoded_message
}
response = (service.users().messages().send(userId="me", body=create_message).execute())
Despite changing the records and testing the reverse lookup (which seems to work correctly), I’m not able to determine why the gmail api is marking the mails as received from unknown.