Thank you very much @oplik0 for your very detailed and helpful answer. I will take a look into the write-api plugin first and see how far I get. From your description it sounds like what I need.
How change sending domain ?
This post is deleted!
sudo apt-get install mailutils sudo apt-get install postfix
sudo nano /etc/postfix/main.cf
inet_interfaces = all
inet_interfaces = localhost
sudo service postfix restart echo "This is the body of the email" | mail -s "This is the subject line" email@example.com sudo nano /etc/aliases # See man 5 aliases for format postmaster: root root: firstname.lastname@example.org
@Dawid-Glomba Good advice, but I don't think it will do anything, he's using SparkPost, not postfix.
That said, something is wrong with your SparkPost. It is failing back to the local address because SparkPost is not working.
invalid domainmessage is coming from SparkPost, because you have not properly set up your DNS records.
Following these instructions should fix it for you.
Have you set the email settings in the admin panel?