SenderError: Mail from command failed - 501 Syntax error

What would cause this error?

  • MailGun is set up and working fine for welcome emails, contact form, etc.
  • Works on localhost but not in production.

Example method:

sendCommentNotification (obj) {
    check(obj, {
      toUserId: String,
      fromUsername: String,
      challengeId: String
    })

    this.unblock()

    Email.send({
      to: 'example@gmail.com',
      replyTo: 'no-reply@example.com',
      from: 'example',
      subject: `${obj.fromUsername} commented on blah blah.`,
      text: `Hey!\n\nClick this link to view ${obj.fromUsername}'s comment:\n\nhttps://example.com/blah/${obj.challengeId}?tab=discussion\n\nThanks!`
    })
    return true
  },

A client method is calling a server method. I’m thinking that might have something to do with it? I think I’ve honestly tried everything at this point and can’t figure this out.

2017-02-26 05:50:23-05:00Exception while invoking method 'insertComment' SenderError: Mail from command failed - 501 Syntax error
3tt4
2017-02-26 05:50:23-05:00 at Object.Future.wait (/app/bundle/programs/server/node_modules/fibers/future.js:449:15)
3tt4
2017-02-26 05:50:23-05:00 at smtpSend (packages/email.js:108:37)
3tt4
2017-02-26 05:50:23-05:00 at Object.Email.send (packages/email.js:211:5)
3tt4
2017-02-26 05:50:23-05:00 at [object Object].insertComment (imports/api/methods/comments.js:80:13)
3tt4
2017-02-26 05:50:23-05:00 at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1712:12)
3tt4
2017-02-26 05:50:23-05:00 at packages/ddp-server/livedata_server.js:711:19
3tt4
2017-02-26 05:50:23-05:00 at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
3tt4
2017-02-26 05:50:23-05:00 at packages/ddp-server/livedata_server.js:709:40
3tt4
2017-02-26 05:50:23-05:00 at [object Object]._.extend.withValue (packages/meteor.js:1122:17)
3tt4
2017-02-26 05:50:23-05:00 at packages/ddp-server/livedata_server.js:707:46
3tt4
2017-02-26 05:50:23-05:00 - - - - -
3tt4
2017-02-26 05:50:23-05:00 at SMTPClient._actionMAIL (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/simplesmtp/lib/client.js:981:23)
3tt4
2017-02-26 05:50:23-05:00 at SMTPClient._onData (/app/bundle/programs/server/npm/node_modules/meteor/email/node_modules/simplesmtp/lib/client.js:354:29)
3tt4
2017-02-26 05:50:23-05:00 at emitOne (events.js:77:13)
3tt4
2017-02-26 05:50:23-05:00 at TLSSocket.emit (events.js:169:7)
3tt4
2017-02-26 05:50:23-05:00 at readableAddChunk (_stream_readable.js:153:18)
3tt4
2017-02-26 05:50:23-05:00 at TLSSocket.Readable.push (_stream_readable.js:111:10)
3tt4
2017-02-26 05:50:23-05:00 at TLSWrap.onread (net.js:537:20)

Is that the actual from value you’re using? If so you probably need a full address with domain.