postal icon indicating copy to clipboard operation
postal copied to clipboard

Sending on Behalf Of

Open asithade opened this issue 9 years ago • 7 comments

Hi there,

Is it possible for postal to send messages on behalf of other users?

I.e; when Campaign Monitor sends an email, it shows something like: on-behalf-of-a3 1

So say I have domain.com and my user has [email protected], I want to send an email on behalf of them as such. Is that possible to do with Postal?

asithade avatar May 17 '17 22:05 asithade

Yes you can, you have to configure the postal mail server to be able to send from any sender, and be sure to add the "sender" header to your emails from your client. For example like this. https://github.com/atech/postal/issues/131#issuecomment-301752362

afanjul avatar May 17 '17 23:05 afanjul

What about incoming mails? I have setup mx record correctly but still unable to recive email. m getting server token invalid error whenever try to send email from gmail to my postal server

adeekakhtar560 avatar May 18 '17 00:05 adeekakhtar560

@johnLeads I think you're having a different issue to what I'm trying to achieve here. Please open a separate issue.

@afanjul Thanks for that. I've set it up, and send in the "Sender" header, but get the following error when I try to send:

Postal::SendError: [UnauthenticatedFromAddress] The From address is not authorised to send mail from this server

I'm using the postal-ruby gem to send this.

The from email is set as [email protected] and the sender is set as my domain. Is this the correct way to set it up?

Postal.send_message do |m|
  m.from        pr.creator_user.firstname + " " + pr.creator_user.lastname + "<" + pr.creator_user.email + ">"
  # m.reply_to		pr.creator_user.email
  m.header      "Sender", "[email protected]"
  m.to          r.email
  m.subject     "[Rally Starter] " + pr.title
  m.plain_body  pr.content
end

asithade avatar May 18 '17 00:05 asithade

Try setting it with:

m.sender = "[email protected]"

adamcooke avatar May 18 '17 10:05 adamcooke

I think it's a method. Maybe:

m.sender "[email protected]"

catphish avatar May 18 '17 14:05 catphish

@catphish is correct. No equals needed.

adamcooke avatar May 18 '17 15:05 adamcooke

That worked perfectly! Thanks guys :)

asithade avatar May 18 '17 18:05 asithade