Experts opinions needed: How (in)secure is this approach?

no. it’s not secure. because a curl http request can spoof any parameter in the request headers.
What you should do?
The least thing you can do is to create a htpassword file in the mail client directory which puts a username & password request before serving the content to the user.
google about making a .htpassword file.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)