Skip to content

How can we override default the Sparkpost From email set in template when we send email from sparkpost python? #230

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
JayDarjiAubergine opened this issue Mar 11, 2025 · 0 comments

Comments

@JayDarjiAubergine
Copy link

JayDarjiAubergine commented Mar 11, 2025

sp = SparkPost(settings.SPARKPOST_API_KEY)
try:
    sp.transmission.send(
        recipients=to,
        bcc=bcc,
        from_email=from_email,    # I tried this, but still it's not working
        template=template_id,
        substitution_data=substitution_data,
        transactional=True,
        ip_pool=settings.SPARKPOST_IP_POOL,
        content={"from": from_email}    # Tried to override the from email like this, but this is not working
    )
except SparkPostAPIException as e:
    capture_exception(e)

This is how we send email, but I want to override the from email in place of default set in template settings.
Why? because we have different from email for different environments.

So How can I achieve that?


Maybe related to this: #161

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant