I assume that you run the game behind some web server, such as apache in production.
By default, the game "application.baseUrl" is used only when the Request object is null (when invoking mail from a job). Here is the code from the framework
String base = Http.Request.current() == null ? Play.configuration.getProperty("application.baseUrl", "application.baseUrl") : Http.Request.current().getBase();
When you call your mail from the controller, the Http.Request.current.getBase () method is called, which may be "http://127.0.0.1:9000" if you are working on the front server.
Perhaps there is some tweaking on the server to correctly transmit the request. Another option is to manually set the base portion of the URL.
In your MailSender class you can store url in a static variable
private static String APPLICATION_URL = Play.configuration.getProperty("application.baseUrl");
add it to your submit method
public class MailSender extends Mailer { public static void registration(User user, String token) { String applicationUrl = APPLICATION_URL; setSubject("User Registration Confirmation")); addRecipient(user.email); setFrom("XXXSystem < auto-mail@xxxsystem.com >"); send(user, token, applicationUrl); } }
and use it in your mail
${applicationUrl}@{Registerer.activateUser(token)}
source share