balderdashy / sails-hook-email

Sails email hook
67 stars 34 forks source link

From in config doesn't work #12

Closed kevinob11 closed 8 years ago

kevinob11 commented 9 years ago

When I set from in config it doesn't seem to work. Example below:

  service: 'gmail',
  auth: {
    user: gmailaddress@gmail.com,
    pass: gmailaddresspassword
  },
  from: 'no-reply@test.com',
  testMode: false

If I send using the above config and without explicitly setting a from when I send then the email will come from gmailaddress@gmail.com. If when I send I do specify a from address (example of that below) then it is from that address that I specified.

sails.hooks.email.send(
          "testEmail",
          {
            param1: 'value'
          },
          {
            to: 'otherperson@gmail.com',
            subject: "1234123asdf4",
                    from: 'no-reply@test.com'
          },
          function(err) {console.log(err || "It worked!");}
        )
sgress454 commented 9 years ago

I just tested this successfully--might pulling the latest down (v0.12.1) and trying again?

jbailey4 commented 8 years ago

I'm seeing some issues with the from attribute also. Basically neither sails-hook-email nor nodemailer respects the from attribute. The value set for from makes it all the way to nodemailer's sendMail method, but when the email is actually delivered it is from the value set for auth.user.

I'm using Gmail and the default user/pass, no oauth. Not sure, but could be an issue with Gmail SMTP...

jbailey4 commented 8 years ago

@kevinob11 are you still having this issue?

kevinob11 commented 8 years ago

I think the issue for me was trying to use an arbitrary from with gmail SMTP. I switched to mailgun and it works as expected now.

kevinob11 commented 8 years ago

@jbailey4 I closed since I initially opened, but let me know if you'd like this reopened.

jbailey4 commented 8 years ago

@kevinob11 So I guess thats the issue, you can't use an arbitrary from email address with gmail SMTP. Thanks for the feedback, I may switch implementations as well.

kevinob11 commented 8 years ago

@jbailey4 yeah, I think a service that is built for it (mailgun, mandrill, postmark) rather than gmail is the right thing to do. If you do want to stick with gmail you could try adding the address as a verified send as address for your account before trying to send from it. That may work.