I have a Java server (WAR) that I develop and I want to add a "contact us" rest API where it will use my gmail account to send the email to me (my gmail account). On my local computer it works and now I want to deploy the war to my vps (ubuntu).
I need to authorize it to use my Gmail account, otherwise I will get a suspicious sign in that was blocked.
How can I do it? Thanks
Using the Gmail API is probably the preferred solution https://developers.google.com/gmail/api
But as a quick alternative:
The typical VPS running Linux has a SMTP server installed that allows you to send mail with either
/usr/lib/sendmail
Reliable mail delivery using your own @example.com domain takes some more effort but your “contact us “ messages have only you yourself as te recipient and if they end up in a spam folder simply white list your app