There is a program that allows the user to enter and add products. When registering, a link is sent to activate the profile. This email looks like this!

photo from email - a

It looks like a link kativatsii

How can I add a photo of this link? If so send something to me is not beautiful :). I want to make it look like this:

Desired result

desired photo

There is a code that allows you to send this link:

@RequestMapping(value = "/register", method = RequestMethod.POST) public String register(@ModelAttribute("user") User user) { user.setPassword(passwordEncoder.encode(user.getPassword())); user.setUserType(UserType.USER); user.setToken(UUID.randomUUID().toString()); userRepository.save(user); String url = String.format("http://localhost:8080/verify?token=%s&email=%s", user.getToken(), user.getEmail()); String text = String.format("Dear %s Thank you, you have successfully registered to our EShop, Please visit by link in order to activate your profile. %s", user.getName(), url); emailServiceImpl.sendSimpleMessage(user.getEmail(), "Welcome", text); return "redirect:/loginPage"; } 

If you count from the bottom this code will be the 2nd 3rd and 4th

we have a class EmailServiceImpl in fact by email some message sends this class in it there is such a code

  @Autowired public JavaMailSender emailSender; public void sendSimpleMessage( String to, String subject, String text) { SimpleMailMessage message = new SimpleMailMessage(); message.setTo(to); message.setSubject(subject); message.setText(text); emailSender.send(message); } 

}

From the beginning, I thought that SimpleMailMessage is such a method that can allow you to send a photo, but in fact there is no method in this class that allows you to send a photo. All code was processed in Spring

    1 answer 1

    1. Upload a picture to some kind of image hosting or to your server. Get a link to the picture.
    2. Write your html variable to your text variable using the <img> , where you specify this link.
    • ok thanks a lot - Developer