I've written code which creates a csv file that is later sent by SendGrid. The code works with gmail. The message shows up in the inbox in an instant, but does not on other clients like CyberFolks. The response status is 202. You can find the part responsible for sending the email below -
SG_apikey = sendgrid_api
from_email = Email("my@mail.com")
to_email = To("my_friends@mail.com")
cc_mail = Cc("my_gmail@gmail.com")
subject = f"Orders from XXX for"
content = Content("text/plain", "Orders from XXX for can be found in attachment")
with open("orders.csv", "rb") as f:
base = base64.b64encode(f.read()).decode()
attachment = Attachment(
file_content=FileContent(base),
file_name=FileName("orders.csv"),
file_type=FileType("text/csv"),
disposition=Disposition("attachment"),
)
mail = Mail(from_email, to_email, subject, content)
mail.add_attachment(attachment)
mail.add_cc(cc_mail)
sendgrid_client = SendGridAPIClient(api_key=SG_apikey)
response = sendgrid_client.send(mail.get())
print(response.status_code)
print(response.headers)
Do you have any ideas for solving this problem?
I have tried :
Changing the MIME TYPES
Checking if the mail address is misspelled
The SendGrid panel. My domain is authorized/validated. But to be sure I have checked/done it more than once.
Sending the email with and without an attachment.