bcomeau / parse-server-mailgun-adapter-template

Used to send Parse Server password reset and email verification emails though Mailgun
Other
11 stars 12 forks source link

Mailgun SDK Error #4

Closed Vortec4800 closed 8 years ago

Vortec4800 commented 8 years ago

I'm setting up verification emails, and it seems like there is an error in the send call.

I'm sending a plaintext email, and this is the data object that is being built:

      var data = {
        from: {name: options.appName, address: mailgunOptions.fromAddress},
        to: options.user.get("email"),
        subject: fillVariables(mailgunOptions.verificationSubject, options),
        text: fillVariables(mailgunOptions.verificationBody, options)
      }

The error I'm receiving says Invalid parameter type. from must be of type: string. so it looks like it's balking at the name and address object in the from field and just wants the from email as a string. Have you seen this before?

bcomeau commented 8 years ago

It's fixed in v1.1.5

Vortec4800 commented 8 years ago

Just saw your commit. It looks like this from object occurs in a few places, like sending HTML email or the other send methods. Also I found the mailgun-js framework (a little confusing because I was looking at the official SDK first but npm points to a different SDK) and you may be able to do:

options.appName + ' <'mailgunOptions.fromAddress'>'

or something like it to approximate the old behavior.

nitrag commented 8 years ago

Sorry, I introduced this bug. This (from [object]) is supported in the mailcomposer module used for sending HTML emails. I should not have included it in the ELSE for plain-text.

Vortec4800 commented 8 years ago

Ah, I didn't realize they were different. What's the best action here? Use the Name format, just the email, or something else? Also I think there may be other plaintext senders that would need to be updated, like the reset password.

nitrag commented 8 years ago

It's ultimately up to @bcomeau, sending the "Name " should be fine these days, but it's not my call.

bcomeau commented 8 years ago

The solution is in issue #5

I think it would be preferable to be similar to the other email-adapters.