If I am using LAC APIs as user registration endpoint for my application, after user registration I want to send an email confirmation email to user email. How would it be possible in LAC? do I need to write Java code to achieve this?
You can send email anywhere in LAC where you can write code. A typical place would be as an event on insert, say if you insert a record for a user registration. You will of course need an email server to communicate with, or some sort of email service like Amazon Simple Email Service. If you're just using SMTP, you might consider using Apache Commons Email, which makes it easy. Just add the jar to your classpath (e.g. lib directory for Tomcat), and you can send an email with:
var SimpleEmail = Java.type("org.apache.commons.mail.SimpleEmail");var email = new SimpleEmail(); email.setHostName("smtp.acme.com"); // Your SMTP server email.setSmtpPort(25);
email.setFrom("email@example.com"); email.setSubject("Test Mail"); email.setMsg("This is a test mail ... :-)"); email.addTo("firstname.lastname@example.org"); email.send();
Full documentation is here: http://commons.apache.org/proper/commons-email/userguide.html
Thank you so much! I will try this.
I have installed LAC on Amazon Elastic Beanstalks, do you know how to add related jars into it?
1 - Add the jars to the Live API Creator war file (in the WEB-INF/lib directory). This can be done using the jar command.
2 - Add the jars to the container's classpath by modifying the war file's .ebextensions.
Thanks @taram, I did try these two ways yesterday with my own. #1 didn't work it may be due to the incorrect jar I was using. I had gone with #2 that seems to be working but still facing some other issues that require some other dependencies needs to be installed which are related to tomcat environment.
Thanks for your reply and suggesting the appropriate ways to do this.
Retrieving data ...