I have a piece of code in Java to verify an email:
MailgunEmailVerificationApi mailgunEmailVerificationApi = MailgunClient.config("https://api.eu.mailgun.net/",
"b6bbdb234cf9dc46250diu606c9e5c198-324e0bb2-46091a28")
.logLevel(feign.Logger.Level.FULL)
.createApi(MailgunEmailVerificationApi.class);
log.info("mail Validation {} ", mailgunEmailVerificationApi.validateAddress("foo@mailgun.com"));
But I am receiving this message in the log => {"message":"This feature is unavailable please contact support."}
Complete Log:
11:29:24.159 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] ---> GET https://api.eu.mailgun.net/v4/address/validate?address=foo%40mailgun.com HTTP/1.1
11:29:24.160 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] Accept: application/json
11:29:24.160 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] Authorization: Basic YXBpOmI2YmJkYjIzNGNmOBkYzYwNmM5ZTVjMTnj84LTMyNGUwYmIyLTQ2MDkxYTI4
11:29:24.160 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] ---> END HTTP (0-byte body)
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] <--- HTTP/1.1 403 Forbidden (329ms)
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] access-control-allow-credentials: true
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] access-control-allow-origin: *
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] cache-control: no-store
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] content-length: 66
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] content-type: application/json; charset=utf-8
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] date: Thu, 26 Oct 2023 08:29:24 GMT
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] strict-transport-security: max-age=63072000; includeSubDomains
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] x-xss-protection: 1; mode=block
11:29:24.490 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress]
11:29:24.491 [main] INFO com.mailgun.util.ConsoleLogger -- [MailgunEmailVerificationApi#validateAddress] {"message":"This feature is unavailable please contact support."}
Read this Github issue -> https://github.com/mailgun/mailgun-php/issues/617
Unfortunately, MailGun supports email validation only on US Servers and not on EU servers.
Solution:
Try to host the MailGun Server in the US region to make the email validation to work.
I see that Email Validation is only offered via v4 APIs.
I'm not sure but I guess v4 features are not free to use and you will need to purchase a subscription to make the v4 API to work.
You will need to use only private key when it comes to v4 APIs.
Screenshot from IntelliJ for MailGun Java SDK: