'Couldn't send an emil via yandex account in spring

I tried to send email using @gmail.com and Everything was fine but client has yandex account and I have some problem with it. The Error is: org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException: 535 5.7.8 Error: authentication failed: Invalid user or password! (But I entered valid account/password)

aplication.properties:

spring.mail.host =smtp.yandex.ru
spring.mail.port=465
[email protected]
spring.mail.password=myAccountPassword123
spring.mail.protocol=smtps
mail.debug=true

Service:

@Service
public class EmailSenderService {
    @Autowired
    private JavaMailSender mailSender;

    public void sendEmail(String toEmail,
                          String subject,
                          String body){
        SimpleMailMessage message = new SimpleMailMessage();
        message.setFrom("[email protected]");

        message.setTo(toEmail);
        message.setText(body);
        message.setSubject(subject);

        mailSender.send(message);
    }
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source