GithubHelp home page GithubHelp logo

Comments (5)

hcxiaoliu avatar hcxiaoliu commented on July 19, 2024

我用的你的demo 把qq邮箱当参数传进去 就报错501 如果写死的话,就可以发送成功,这是为什么啊

from spring-boot-examples.

hcxiaoliu avatar hcxiaoliu commented on July 19, 2024

楼主有遇到过这种情况么

from spring-boot-examples.

hcxiaoliu avatar hcxiaoliu commented on July 19, 2024

我还有一个疑问,因为发送邮件的话,我必须要本地配置那个smpt 服务 有密码 但是我要群发,那密码怎么办,我怎么群发啊 没密码就不能发,我用别人账号测试,就那个秘钥错误就不能发送

from spring-boot-examples.

cxyxiaokui avatar cxyxiaokui commented on July 19, 2024

首先第一个问题 如果写死发送者的邮件地址可以发送成功,这说明发送邮件程序时没有问题的,真正的问题应该是在传递参数的时候是否邮件地址发生改变了 所以发送不成功。建议你debug跟一下断点,另外就是要看一下具体的错误信息进行分析。
第二个问题
1.首先你肯定是需要在 application.properties中配置 spring.mail.host, spring.mail.username和spring.mail.password 因为程序代替你发送邮件 发送方的邮箱和密码是必须要进行配置的。
还有一点需要注意的是 spring.mail.username配置的邮箱地址和 spring.mail.host邮箱域名要一致。例如你的spring.mail.username是126的邮箱 那么你的spring.mail.host要配置成smtp.126.com 如果是163的邮箱那么spring.mail.host要配置成smtp.163.com 如果是qq的邮箱 spring.mail.host要配置 smtp.qq.com。
2. 如果有别人的账号测试 在 application.properties邮箱和密码不对的话 不能发送是很定的
3.如果要进行群发可以调用MimeMessageHelper的setTo(String[] to)方法 我刚写了一个测试用例在本地测试了一下没有什么问题具体地址如下:https://github.com/zhuoqianmingyue/springbootexamples/blob/master/lesson11_mail/src/test/java/cn/lijunkui/mail/MailServiceTest.java 请参考sendInlineResourceMailForGroupSending测试用例的方法

from spring-boot-examples.

hcxiaoliu avatar hcxiaoliu commented on July 19, 2024

嗯嗯,感谢楼主热忱的回答,昨晚那个问题我解决了,今晚测一下这个群发,看看

from spring-boot-examples.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.