Skip to content
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

Attaching files #63

Open
8vius opened this issue Apr 19, 2019 · 0 comments
Open

Attaching files #63

8vius opened this issue Apr 19, 2019 · 0 comments

Comments

@8vius
Copy link

8vius commented Apr 19, 2019

I don't quite get how to attach files to an email, I checked the API and it says it should be under the content.attachments section as an array, yet doing this doesn't seem to work, this is how I'm sending my email:

  def buyer_tickets_email(order)
    @order = order
    data = {
      substitution_data: purchase_order_details(@order),
      content: {
        attachments: order.tickets.map do |ticket|
          {
            name: "#{ticket_file_name(ticket)}.pdf",
            type: "application/pdf",
            data: ticket.to_pdf
          }
        end
      },
      template_id: 'buyer-tickets-email'
    }
    mail to: @order.email, subject: I18n.t('tickets_mailer.subject'), sparkpost_data: data
  end

Am I missing something? The email arrives correctly yet without the attached pdfs

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