postal icon indicating copy to clipboard operation
postal copied to clipboard

Not clear how to authenticate addresses

Open matthewbloch opened this issue 8 years ago • 5 comments

I've installed Postal successfully, created a Server and got the API working. I've added the domain x.bloch.tv under the server, and it has verified all my DNS records, for what that's worth. I've added an Address Endpoint to match the email that I want to send from, and written this test script:

curl \
  -H"Content-Type: application/json" \
  -H"X-Server-API-Key: xxx" \
  https://postal.x.bloch.tv/api/v1/send/raw \
  -d'{
    "mail_from":"[email protected]",
    "rcpt_to":["[email protected]"],
    "data":"From: [email protected]\nSubject: testing 1 2 3 4\n\nhello"
}'

But I always get this error back:

{"status":"error","time":0.0,"flags":{},"data":{"code":"UnauthenticatedFromAddress","message":"The From address is not authorised to send mail from this server"}}

Where in the front-end do I go to authenticate an email address? The address I configured in the postal.yml doesn't work, nor the email address used for my user login. I believe I've clicked around the whole thing and I'm missing something obvious.

Thanks in advance :smile:

matthewbloch avatar Mar 19 '18 18:03 matthewbloch

OK, I worked it out! I was not sending base64-encoded JSON.

This script worked:

#!/bin/sh

MESSAGE=`echo "From: [email protected]\nSubject: testing 1 2 3 4\n\nhello" | base64 -w0`

curl \
  -H"Content-Type: application/json" \
  -H"X-Server-API-Key: xxx" \
  https://postal.x.bloch.tv/api/v1/send/raw \
  -d'{
    "mail_from":"[email protected]",
    "rcpt_to":["[email protected]"],
    "data":"'$MESSAGE'",
}'

matthewbloch avatar Mar 20 '18 17:03 matthewbloch

Glad you figured it out, the full documentation is here https://atech.github.io/postal-api/controllers/send/raw.html

willpower232 avatar Mar 22 '18 21:03 willpower232

Glad you figured it out, the full documentation is here https://atech.github.io/postal-api/controllers/send/raw.html

@willpower232 could you please update the url as it points to 404?

rbashish avatar Jun 25 '20 11:06 rbashish

re #1030 the link is now https://krystal.github.io/postal-api/controllers/send/raw.html

willpower232 avatar Jun 25 '20 12:06 willpower232

re #1030 the link is now https://krystal.github.io/postal-api/controllers/send/raw.html

This works now. Thanks!

rbashish avatar Jun 25 '20 13:06 rbashish