Reputation: 158
I'm trying to create an application in grails v. 2.3.4. This app has a feature where every logged in user should be able to send email to anyone and the tricky part here is that I want to let the user to configure its own mail configurations at runtime (configurations are submitted by user in application's front-end).
In other words, change these conf's dynamically:
Taken from config.groovy:
mail {
host = "SMTP SERVER"
port = PORT_NUM
username = "[email protected]"
password = "UsersPassword"
props = ["mail.smtp.auth":"true",
"mail.smtp.socketFactory.port":"PORT_NUM"
]
}
is it possible to do so with this plugin?, is there any other way to do so?
I have already seen this thread and no success: Grails2.1 Dynamic mail configuration
Upvotes: 0
Views: 990
Reputation: 5540
Forget the mail plugin. You can look at it's source code for reference and sample usage, but you have to work with javamail framework to create your required custom service.
For in-depth reference, see javamail docs here.
For a quick intro, look at this article.
Upvotes: 1
Reputation: 2676
Look here --> Changing mail configuration in runtime
You can inject the mailSender bean an alter the properties ... didn't found a different way if you want to use the plugin.
Upvotes: 2