Send mail using gmail from Oracle ADF
JDev: 12.2.1.3.0
Source: GitHub
This article talks about using Google services (Gmail) to send email from an ADF application. I doubt that there would be a real-world use-case for this, but nonetheless, the email integration would be the major takeaway from this blog.
This does not use any ADF related package. Any Java application is good enough for this.
To start with, I have an ADF application, with just the ViewController project. I don't need any Model support for my sample project. The UI captures the required details.
However, before you start sending emails from your Google account, you need to allow "less secure apps" to access your Google account. Now this is not recommended, but try it out for once. Visit https://myaccount.google.com/security, scroll down till the end and set "Allow less secure apps: ON".
The emailing will be taken care of by javax.mail package. Let us break up the activities into the following sections:
Note: multiple recipients (to, cc and bcc) can be separated by COMMA.
Your sender GMail account will have this email in Sent Items.
Cheers!
Source: GitHub
This article talks about using Google services (Gmail) to send email from an ADF application. I doubt that there would be a real-world use-case for this, but nonetheless, the email integration would be the major takeaway from this blog.
This does not use any ADF related package. Any Java application is good enough for this.
To start with, I have an ADF application, with just the ViewController project. I don't need any Model support for my sample project. The UI captures the required details.
| Email UI |
However, before you start sending emails from your Google account, you need to allow "less secure apps" to access your Google account. Now this is not recommended, but try it out for once. Visit https://myaccount.google.com/security, scroll down till the end and set "Allow less secure apps: ON".
| Allow less secure apps from your Google settings |
The emailing will be taken care of by javax.mail package. Let us break up the activities into the following sections:
| Set system properties for GMail |
| Set authentication provider |
| Read from, to and subject Strings from UI |
Note: multiple recipients (to, cc and bcc) can be separated by COMMA.
| Set email content body |
| Set email attachment |
| Send your email |
Your sender GMail account will have this email in Sent Items.
Cheers!
Comments
Post a Comment