I’m running into an issue trying to use Mailgun in my Ionic 3 app. When I run the function to send mail in the browser, I have a Chrome plugin that allows me to enable CORS and it can send the message just fine. However, in my app on my device, when I try to send an email, I get an error:
Are you in deploy or --prod mode? This is normal if you can in browser (ionic serve) because it deletes the CORS for testing purposes. Have a look on the forum with CORS keyword for more information.
Hm an interesting question. I run ionic cordova build ios when I’m testing because adding the --prod flag adds so much extra time. Maybe I should try it with it to see if that solves the problem?
UPDATE: Alright, so I tried this with the --prod flag and I’m still running into that same error. I couldn’t quite find anything useful about CORS on the ionic forum. Is there anything in particular you might be able to point me to?
CORS is an error raised because you’re trying to use a domain or subdomain (DNS) you have no permission for. It’s meant to prevent hackers to use something or server they are not allowed to use (cross domain hack).
iOS is very strict about that, more than Android. Anyways, you’ll still have the issue as long as you’re trying to send an email from an unregistered / unauthorized domain in a real production app.
For the rest, you can disable CORS policy for testing, there is a fix for iOS somewhere in forums.
Thankyou very much for this information. I actually think I have an alternative option than sending an email and running into this CORS request. I’ll go with that for now.