当我使用 JavaMail 和 SMTP 发送邮件时 Gmail 被禁用

问题描述 投票:0回答:0

我使用 JavaMail 向另一个帐户发送电子邮件。我已经为第三方应用程序设置了应用程序的密码等等,一切都很完美。之后,我的gmail账号因为发送垃圾邮件被停用了

this is the image of my disabled gmail when I tried to log in

这是我在 application.properties 文件中的配置

spring.mail.host=smtp.gmail.com
spring.mail.port=587
[email protected]
spring.mail.password=dexsbwukxrnijzpn                   # application's password
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.starttls.enable=true

这是我用来向任何忘记密码登录我的应用程序的用户发送一个新的临时随机密码的邮件的功能

`public String getNewTemporaryRandomPasswordMail(String userName, String email) {
    String fromAddress = "[email protected]";
    String senderName = "Fool!st Fashion Store";
    String subject = "Your new temporary password";

    // function to create a random password string
    String newTempPassoword = ValueRenderUtils.randomTemporaryPassword(userName);

    String content =  "Dear [[name]],<br>"
                    + "Your new temporary password is " + newTempPassoword + "<br>"
                    + "Please rememder to change a new password for your new account because this temporary password will be changed after you close the website !!<br><br>"
                    + "Thank you,<br>"
                    + "Fool!st Fashion Store";

    MimeMessage message = mailSender.createMimeMessage();
    MimeMessageHelper helper = new MimeMessageHelper(message);

    try {
        helper.setFrom(fromAddress, senderName);helper.setTo(email);
        helper.setSubject(subject);

        content = content.replace("[[name]]", userName);

        helper.setText(content, true);
    }
    catch (Exception e) {
        e.printStackTrace();
    }

    mailSender.send(message);

    return newTempPassoword;
}`

有人知道我的 gmail 帐户被禁用的原因吗?请帮助我解决这个问题,我花了几天时间研究我做错了什么但我什么也没得到,我将不胜感激!谢谢

smtp jakarta-mail gmail-api sendmail spam
© www.soinside.com 2019 - 2024. All rights reserved.