Not clear how to authenticate addresses
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:
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'",
}'
Glad you figured it out, the full documentation is here https://atech.github.io/postal-api/controllers/send/raw.html
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?
re #1030 the link is now https://krystal.github.io/postal-api/controllers/send/raw.html
re #1030 the link is now https://krystal.github.io/postal-api/controllers/send/raw.html
This works now. Thanks!