pboling / sanitize_email

An Email Condom for your Ruby Server
http://railsbling.com/sanitize_email/
MIT License
167 stars 36 forks source link

Emails are not sanitized when sent through SendGrid `personalizations` argument #73

Closed joeyparis closed 6 months ago

joeyparis commented 3 years ago

When sending multiple emails via SendGrid's personalizations argument the sanitized recipients are not applied (although the other sanitizations seem to be. I haven't been able to dive deep into the difference of how this option sends to give more insight yet, but I wanted to get this issue recorded. I'll do some more research tomorrow and update this issue.

mail({
    to: "account@external_domain.com",  # Properly sanitized
    from: "mail@website.com",
    subject: "Hello",
    body: "World!",
    personalizations: [
        {
            to: [{ email: "second_account@external_domain.com"}], # Not properly sanitized, sent to actual recipient
            bcc: [{ email: "copy@external_domain.com"}] # Also, not properly sanitized, sent to actual recipient
        },
    ]
})

Under normal circumstances, SendGrid would create two emails from this request. One to account@external_domain.com and one to second_account@external_domain.com with a bcc to copy@external_domain.com.


Update 2020-08-17 11:03AM ET This is more likely to be the sendgrid-actionmailer gem than the sendgrid-ruby gem.

pboling commented 6 months ago

Sorry I missed this!