Skip to content

How to attach file for each specific email ? #302

Description

@huynd26

Reporting an error? It's helpful to know:
I have some changes in ics file for each recipient and want to make sure that each recipient gets their own ics file instead of one attachment for all emails like below.

    msg = AnymailMessage(
        subject=subject, body=body, from_email=from_email, to=list_emails
    )
    msg.attach("meeting_invite.ics", meeting_invite, "text/calendar")
  • Anymail version : 7.0.0
  • ESP (Mailgun, SendGrid, etc.) : SparkPost = 1.3.6
  • Your ANYMAIL settings (change secrets to "redacted") :
    "SPARKPOST_API_KEY": os.environ.get("SPARKPOST_API_KEY"),
    "SEND_DEFAULTS": {
        "esp_extra": {
            "transactional": True,
            "return_path": "mail@bounces.project.com",
            "ip_pool": "project",
        },
        "track_clicks": True,
    },
    "WEBHOOK_SECRET": os.environ.get("ANYMAIL_WEBHOOK_SECRET"),
}
EMAIL_BACKEND = "anymail.backends.sparkpost.EmailBackend"```
- Versions of Django, requests, python
Django=3.2.18, python=3.9.15+


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions