javamail 接收邮件,总是报javax.mail.NoSuchProviderException: invalid provider 5C

javamail接收邮件的时候,报错误

  public Store createStore() throws NoSuchProviderException {

        Properties properties = System.getProperties();
        properties.setProperty("mail.store.protocol", "smtp");
        properties.setProperty("mail.smtp.host", "smtp.qq.com");
        //认证连接
        properties.setProperty("mail.smtp.auth", "true");
        Session session = Session.getDefaultInstance(properties,null);
        session.setDebug(false);
        //创建连接邮件服务器 smtp
        return session.getStore(protoco);
    }

`然后启动运行报错
javax.mail.NoSuchProviderException: invalid provider
at javax.mail.Session.getStore(Session.java:655) ~[javax.mail-1.6.2.jar:1.6.2]
at javax.mail.Session.getStore(Session.java:621) ~[javax.mail-1.6.2.jar:1.6.2]
at javax.mail.Session.getStore(Session.java:600) ~[javax.mail-1.6.2.jar:1.6.2]
at com.geely.trip.messagecenter.utils.MailUtils.createStore(MailUtils.java:80) ~[classes/:?]
at com.geely.trip.messagecenter.service.EmailService.queryEmail(EmailService.java:261) ~[classes/:?]
at com.geely.trip.messagecenter.service.EmailService$$FastClassBySpringCGLIB$$f966b9a6.invoke() ~[classes/:?]
at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) ~[spring-core-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:684) ~[spring-aop-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at com.geely.trip.messagecenter.service.EmailService$$EnhancerBySpringCGLIB$$beacfde0.queryEmail() ~[classes/:?]
at com.geely.trip.messagecenter.controller.EmailController.queryEmail(EmailController.java:117) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_181]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_181]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_181]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_181]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:209) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:891) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:991) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [javax.servlet-api-3.1.0.jar:3.1.0]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) [spring-webmvc-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [javax.servlet-api-3.1.0.jar:3.1.0]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.1.9.jar:1.1.9]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:90) [spring-boot-actuator-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:109) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.cloud.sleuth.instrument.web.ExceptionLoggingFilter.doFilter(ExceptionLoggingFilter.java:48) [spring-cloud-sleuth-core-2.0.1.RELEASE.jar:2.0.1.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at brave.servlet.TracingFilter.doFilter(TracingFilter.java:86) [brave-instrumentation-servlet-5.1.4.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:155) [spring-boot-actuator-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:123) [spring-boot-actuator-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:108) [spring-boot-actuator-2.0.5.RELEASE.jar:2.0.5.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-5.0.9.RELEASE.jar:5.0.9.RELEASE]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:493) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498) [tomcat-embed-core-8.5.34.jar:8.5.34]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.34.jar:8.5.34]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.34.jar:8.5.34]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
2019-03-13 19:12:55 [ http-nio-9002-exec-3:21999 ] - [ WARN ] org.springframework.web.servlet.handler.AbstractHandlerExceptionResolver.resolveException(AbstractHandlerExceptionResolver.java:140) Resolved [javax.mail.NoSuchProviderException: invalid provider]
2019-03-13 19:13:12,314 INFO [Thread-30] server.JettyServer$1 (JettyServer.java:56) - >>>>>>>>>>> xxl-rpc server join success, netcon=com.xxl.job.core.rpc.netcom.jetty.server.JettyServer, port=9992
2019-03-13 19:17:47,162 INFO [AsyncResolver-bootstrap-executor-0] aws.ConfigClusterResolver (ConfigClusterResolver.java:43) - Resolving eureka endpoints via configuration
2019-03-13 19:18:06 [ http-nio-9002-exec-4:333136 ] - [ INFO ] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:205) Fetching config from server at : http://10.86.216.184:8083/
2019-03-13 19:18:06 [ http-nio-9002-exec-4:333501 ] - [ INFO ] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.log(ConfigServicePropertySourceLocator.java:149) Located environment: name=messagecenterxzy-v06, profiles=[localhost], label=master, version=47f76ee9b39bcda0ea0907280f06820b80e127de, state=null
2019-03-13 19:22:47,167 INFO [AsyncResolver-bootstrap-executor-0] aws.ConfigClusterResolver (ConfigClusterResolver.java:43) - Resolving eureka endpoints via configuration
2019-03-13 19:23:26 [ http-nio-9002-exec-8:653135 ] - [ INFO ] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:205) Fetching config from server at : http://10.86.216.184:8083/
2019-03-13 19:23:26 [ http-nio-9002-exec-8:653453 ] - [ INFO ] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.log(ConfigServicePropertySourceLocator.java:149) Located environment: name=messagecenterxzy-v06, profiles=[localhost], label=master, version=47f76ee9b39bcda0ea0907280f06820b80e127de, state=null
2019-03-13 19:27:47,169 INFO [AsyncResolver-bootstrap-executor-0] aws.ConfigClusterResolver (ConfigClusterResolver.java:43) - Resolving eureka endpoints via configuration
2019-03-13 19:28:46 [ http-nio-9002-exec-5:973135 ] - [ INFO ] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.getRemoteEnvironment(ConfigServicePropertySourceLocator.java:205) Fetching config from server at : http://10.86.216.184:8083/
2019-03-13 19:28:46 [ http-nio-9002-exec-5:973441 ] - [ INFO ] org.springframework.cloud.config.client.ConfigServicePropertySourceLocator.log(ConfigServicePropertySourceLocator.java:149) Located environment: name=messagecenterxzy-v06, profiles=[localhost], label=master, version=47f76ee9b39bcda0ea0907280f06820b80e127de, state=null

2个回答

java 发送邮件工具类,发送html、带附件的均可 https://faceghost.com/article/134361

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
邮件javax.mail.AuthenticationFailedException

SEVERE: Servlet.service() for servlet [springMVC] in context with path [/sm] threw exception [Request processing failed; nested exception is org.springframework.mail.MailAuthenticationException: Authentication failed; nested exception is javax.mail.AuthenticationFailedException] with root cause javax.mail.AuthenticationFailedException at javax.mail.Service.connect(Service.java:319) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:397) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:308) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:297) at com.dounine.springmvc.util.Email.sendMail(Email.java:21) at com.dounine.springmvc.controller.AccessController.sendMail(AccessController.java:51) at com.dounine.springmvc.controller.AccessController$$FastClassBySpringCGLIB$$d73def72.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:711) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:644) at com.dounine.springmvc.controller.AccessController$$EnhancerBySpringCGLIB$$1750d0fa.sendMail(<generated>) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863) at javax.servlet.http.HttpServlet.service(HttpServlet.java:647) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) at javax.servlet.http.HttpServlet.service(HttpServlet.java:728) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603) at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) jdbc.properties: jdbc.driver=com.mysql.jdbc.Driver jdbc.url=jdbc:mysql://localhost/test?useUnicode=true&amp;characterEncoding=UTF-8 jdbc.username=root jdbc.password=123 email.smtp=smtp.qq.com email.username=836421293@qq.com email.password=qkldf1993,03,16 email.from=dounine email.subject=dounine public void sendMail(String adressTo, String string) { SimpleMailMessage message = new SimpleMailMessage(mailMessage);// 设置email内容, System.out.println(adressTo); System.out.println(string); message.setTo(adressTo); message.setText(string); mailSender.send(message); } debug发现是在执行mailSender.send(message);时报的错;有没有人知道是哪错了

使用JavaMail出现的异常

用的是163邮箱,授权已开,在使用JavaMail发邮件,每天开始的几封能正常发送出去,后面会出现以下异常: ![图片说明](https://img-ask.csdn.net/upload/201904/04/1554349453_507162.png) 源码是: ``` package test.ceshi; import java.io.File; import java.io.IOException; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message.RecipientType; import javax.mail.MessagingException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeBodyPart; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMultipart; public class MailTest { public static void main(String[] args) throws AddressException, MessagingException, IOException { Properties pro = new Properties(); pro.put("mail.smtp.host", "smtp.163.com"); pro.put("mail.smtp.auth", "true"); //pro.setProperty("mail.smtp.starttls.enable", "true"); Authenticator auth = new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("用户名", "授权码"); } }; Session session = Session.getInstance(pro, auth); MimeMessage msg = new MimeMessage(session); msg.setFrom(new InternetAddress("我的邮箱")); msg.setRecipients(RecipientType.TO, "发送给的邮箱"); msg.setSubject("我自己的邮件"); msg.setContent("我的邮件正文", "text/html;charset=utf-8"); Transport.send(msg); } } ``` 上网查了方法把上述注释打开则会出现以下异常: ![图片说明](https://img-ask.csdn.net/upload/201904/04/1554350095_848860.png) 各种方法都试过了还是解决不了,求大神解答,谢谢!

javamail发送邮件报错,求指教。

前段时间写了一个简单的javamail发送邮件的功能,测试功能正常后就没管了。今天再次测试的时候,发现居然报错了。求大神指点指点。 package com.temp.test; import java.io.UnsupportedEncodingException; import java.util.Date; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.NoSuchProviderException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; /** @author xuyl@scoretk.com @date 2014-2-11 上午06:53:10 */ public class MailUtil { static int port = 25; static String server = "smtp.163.com";//邮件服务器mail.cpip.net.cn static String from = "张三";//发送者,显示的发件人名字 static String user = "cqsiai@163.com";//发送者邮箱地址 static String password = "admin123";//密码 public static void sendEmail(String email, String subject, String body) throws UnsupportedEncodingException { try { Properties props = new Properties(); props.put("mail.smtp.host", server); props.put("mail.smtp.port", String.valueOf(port)); props.put("mail.smtp.auth", "true"); Transport transport = null; Session session = Session.getDefaultInstance(props, null); transport = session.getTransport("smtp"); transport.connect(server, user, password); MimeMessage msg = new MimeMessage(session); msg.setSentDate(new Date()); InternetAddress fromAddress = new InternetAddress(user,from,"UTF-8"); msg.setFrom(fromAddress); InternetAddress[] toAddress = new InternetAddress[1]; toAddress[0] = new InternetAddress(email); msg.setRecipients(Message.RecipientType.TO, toAddress); msg.setSubject(subject, "UTF-8"); msg.setText(body, "UTF-8"); msg.saveChanges(); transport.sendMessage(msg, msg.getAllRecipients()); } catch (NoSuchProviderException e) { e.printStackTrace(); } catch (MessagingException e) { e.printStackTrace(); } } public static void main(String args[]) throws UnsupportedEncodingException { sendEmail("378675113@qq.com","邮件测试","hello");//收件人 System.out.println("ok"); } } 报错内容: javax.mail.MessagingException: IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain; charset=UTF-8 at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1177) at com.temp.test.MailUtil.sendEmail(MailUtil.java:45) at com.temp.test.MailUtil.main(MailUtil.java:55) Caused by: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/plain; charset=UTF-8 at javax.activation.ObjectDataContentHandler.writeTo(DataHandler.java:841) at javax.activation.DataHandler.writeTo(DataHandler.java:295) at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1485) at javax.mail.internet.MimeMessage.writeTo(MimeMessage.java:1773) at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:1121) ... 2 more ok

javamail无法获取邮件正文!急求

已经解决好久了没解决出来,拜托各位了! 代码是参考网上的,原来使用ServletOutputStream输出是可以正确显示内容的,但是会在一个空白页面显示,不是我想要的像普通邮箱的那种显示邮件内容的效果。 网上说要用(String)part.getContent(),我用了然后会报错javax.mail.internet.MimeMultipart cannot be cast to java.lang.String 为什么呀,到底哪里不对? 感激不尽!!求助~ ``` package mail; import java.io.IOException; import java.io.OutputStreamWriter; import javax.mail.BodyPart; import javax.mail.Folder; import javax.mail.Message; import javax.mail.Multipart; import javax.mail.Part; import javax.servlet.ServletException; import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @SuppressWarnings("serial") public class DisplayContent extends HttpServlet { public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ServletOutputStream sos = response.getOutputStream(); HttpSession session = request.getSession(); int msgnum = Integer.parseInt(request.getParameter("msgnum")); Folder folder = (Folder) session.getAttribute("folder"); StringBuffer bodyText=new StringBuffer(); try { Message msg = folder.getMessage(msgnum); // 邮件类型不是mixed时,表示邮件中不包含附件,直接输出邮件内容 if (!msg.isMimeType("multipart/mixed")) { // response.setContentType("message/rfc822"); // msg.writeTo(sos); Part part=(Part)msg; Object o=(Object)part.getContent(); bodyText.append((String) o); System.out.println("bodyText.toString():"+bodyText.toString()); } else { // 查找并输出邮件中的邮件正文 Multipart mp = (Multipart) msg.getContent(); int bodynum = mp.getCount(); for (int i = 0; i < bodynum; i++) { BodyPart bp = mp.getBodyPart(i); /* * MIME消息头中不包含disposition字段, 并且MIME消息类型不为mixed时, * 表示当前获得的MIME消息为邮件正文 */ if (!bp.isMimeType("multipart/mixed") && bp.getDisposition() == null) { response.setContentType("message/rfc822"); bp.writeTo(sos); } } } } catch (Exception e) { e.printStackTrace(); } } } ```

javamail发送邮件问题

package org.easyshop.ext; import java.util.Date; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.NoSuchProviderException; import javax.mail.PasswordAuthentication; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class MailUtil { static int port=25; static String server="smtp.qq.com"; static String from="zxlcd520@qq.com"; static String user="zxlcd520"; static String password="*******"; public static void sendEmail(String email,String subject,String body){ try{ Properties props=new Properties(); props.setProperty("mail.transport.protocol","smtp"); props.put("mail.smtp.host",server); props.put("mail.smtp.port",String.valueOf(port)); props.put("mail.smtp.auth","true"); //Transport transport=null; MyAuthenticator myauth = new MyAuthenticator(user, password); Session session=Session.getDefaultInstance(props,myauth); session.setDebug(true); //transport=session.getTransport("smtp"); //transport.connect(server,user,password); MimeMessage msg=new MimeMessage(session); msg.setSentDate(new Date()); InternetAddress fromAddress=new InternetAddress(from); msg.setFrom(fromAddress); InternetAddress[] toAddress=new InternetAddress[1]; toAddress[0]=new InternetAddress(email); msg.setRecipients(Message.RecipientType.TO,toAddress); msg.setSubject(subject,"GBK"); msg.setText(body,"GBK"); msg.saveChanges(); //transport.sendMessage(msg,msg.getAllRecipients());System.out.print("ok"); Transport.send(msg); }catch(NoSuchProviderException e){ e.printStackTrace(); }catch(MessagingException e){ e.printStackTrace(); } } } class MyAuthenticator extends javax.mail.Authenticator { private String strUser; private String strPwd; public MyAuthenticator(String user, String password) { this.strUser = user; this.strPwd = password; } protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(strUser, strPwd); } } [color=blue]以上是我javamail完整的代码,但是我调试了很久都不能成功,以下是调试信息.smtp服务器地址换成126的也不行,难道是现在的邮件服务器不支持客户端了?我是第一次用javamail有很多东西不知道请各位指点~~[/color] [color=red]DEBUG: setDebug: JavaMail version 1.3.1 DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: trying to connect to host "smtp.qq.com", port 25 220 esmtp6.qq.com Esmtp QQ Mail Server DEBUG SMTP: connected to host "smtp.qq.com", port: 25 EHLO PC-200201012241 250-esmtp6.qq.com 250-PIPELINING 250-SIZE 52428800 250-AUTH LOGIN 250-AUTH=LOGIN 250 8BITMIME DEBUG SMTP: Found extension "PIPELINING", arg "" DEBUG SMTP: Found extension "SIZE", arg "52428800" DEBUG SMTP: Found extension "AUTH", arg "LOGIN" DEBUG SMTP: Found extension "AUTH=LOGIN", arg "" DEBUG SMTP: Found extension "8BITMIME", arg "" DEBUG SMTP: Attempt to authenticate AUTH LOGIN 334 VXNlcm5hbWU6 NDU0NzczMDk1 334 UGFzc3dvcmQ6 MTk4ODAxMjAzMTQ0NTQ= 454 Authentication failed javax.mail.SendFailedException: Sending failed; nested exception is: class javax.mail.AuthenticationFailedException at javax.mail.Transport.send0(Transport.java:218) at javax.mail.Transport.send(Transport.java:80)[/color] [b]问题补充:[/b] TO:lewhwa 谢谢。我试了N次终于成功了,是的,程序完全没有问题。 原因是126邮箱已经不支持SMTP/POP3了。我用OUTLOOK连不上。后面用QQ试了半天终于在开启SMTP/POP3后成功了。但问题是这样的,我想实现一个网站注册时给新用户发激活邮件,这样如果像126这样或QQ邮箱(默认是不开启SMTP/POP3的)是收不到我用客户羰发的邮件!那该怎么办呢? [b]问题补充:[/b] TO:lewhwa 呵呵,我理解你的意思,但是如果接收方没有POP3会被退信的。我刚刚就试过向126邮箱发信但都被退回了,后面只好向另一个QQ邮箱发~

使用javamail发送邮件出现问题

下面是错误信息 DEBUG: JavaMail version 1.4ea DEBUG: java.io.FileNotFoundException: C:\Users\xiaoding\MyEclipse 2016 CI\binary\com.sun.java.jdk8.win32.x86_64_1.8.0.u66\jre\lib\javamail.providers (系统找不到指定的文件。) DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.providers DEBUG: successfully loaded resource: /META-INF/javamail.default.providers DEBUG: Tables of loaded providers DEBUG: Providers Listed By Class Name: {com.sun.mail.smtp.SMTPSSLTransport=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], com.sun.mail.smtp.SMTPTransport=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc], com.sun.mail.imap.IMAPSSLStore=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3SSLStore=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], com.sun.mail.imap.IMAPStore=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], com.sun.mail.pop3.POP3Store=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc]} DEBUG: Providers Listed By Protocol: {imaps=javax.mail.Provider[STORE,imaps,com.sun.mail.imap.IMAPSSLStore,Sun Microsystems, Inc], imap=javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Sun Microsystems, Inc], smtps=javax.mail.Provider[TRANSPORT,smtps,com.sun.mail.smtp.SMTPSSLTransport,Sun Microsystems, Inc], pop3=javax.mail.Provider[STORE,pop3,com.sun.mail.pop3.POP3Store,Sun Microsystems, Inc], pop3s=javax.mail.Provider[STORE,pop3s,com.sun.mail.pop3.POP3SSLStore,Sun Microsystems, Inc], smtp=javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc]} DEBUG: successfully loaded resource: /META-INF/javamail.default.address.map DEBUG: !anyLoaded DEBUG: not loading resource: /META-INF/javamail.address.map DEBUG: java.io.FileNotFoundException: C:\Users\xiaoding\MyEclipse 2016 CI\binary\com.sun.java.jdk8.win32.x86_64_1.8.0.u66\jre\lib\javamail.address.map (系统找不到指定的文件。) DEBUG: getProvider() returning javax.mail.Provider[TRANSPORT,smtp,com.sun.mail.smtp.SMTPTransport,Sun Microsystems, Inc] DEBUG SMTP: useEhlo true, useAuth true DEBUG SMTP: trying to connect to host "smtp.qq.com", port 25, isSSL false 220 smtp.qq.com Esmtp QQ Mail Server DEBUG SMTP: connected to host "smtp.qq.com", port: 25 EHLO DESKTOP-FVJB5A5 250-smtp.qq.com 250-PIPELINING 250-SIZE 73400320 250-STARTTLS 250-AUTH LOGIN PLAIN 250-AUTH=LOGIN 250-MAILCOMPRESS 250 8BITMIME DEBUG SMTP: Found extension "PIPELINING", arg "" DEBUG SMTP: Found extension "SIZE", arg "73400320" DEBUG SMTP: Found extension "STARTTLS", arg "" DEBUG SMTP: Found extension "AUTH", arg "LOGIN PLAIN" DEBUG SMTP: Found extension "AUTH=LOGIN", arg "" DEBUG SMTP: Found extension "MAILCOMPRESS", arg "" DEBUG SMTP: Found extension "8BITMIME", arg "" DEBUG SMTP: Attempt to authenticate AUTH LOGIN 334 VXNlcm5hbWU6 MTE5Mjg2MjUzMQ== 530 Error: A secure connection is requiered(such as ssl). More information at http://service.mail.qq.com/cgi-bin/help?id=28 javax.mail.AuthenticationFailedException 下面是代码 package until; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import javax.mail.internet.MimeMessage.RecipientType; public class sendMail { public static void main() throws AddressException,MessagingException { Properties properties = new Properties(); properties.put("mail.transport.protocol", "smtp");// 连接协议 properties.put("mail.smtp.host", "smtp.qq.com");// 主机名 properties.put("mail.smtp.port", 465);// 端口号 properties.put("mail.smtp.auth", "true"); properties.put("mail.smtp.ssl.enable", "true");//设置是否使用ssl安全连接 ---一般都使用 properties.put("mail.debug", "true");//设置是否显示debug信息 true 会在控制台显示相关信息 //得到回话对象 Session session = Session.getInstance(properties); // 获取邮件对象 Message message = new MimeMessage(session); //设置发件人邮箱地址 message.setFrom(new InternetAddress("2557276052@qq.com")); message.setRecipients(RecipientType.TO,new InternetAddress[] { new InternetAddress("987654321@qq.com") }); //设置邮件标题 message.setSubject("这是第一封Java邮件"); //设置邮件内容 message.setText("内容为: 这是第一封java发送来的邮件。"); //得到邮差对象 Transport transport = session.getTransport(); //连接自己的邮箱账户 transport.connect("xxxxxx", "cbeeweiryvvugchc");//用户名和密码 transport.sendMessage(message, message.getAllRecipients()); } }

发送邮件功能在生产环境失效

同样的一套代码,在本地能够发送邮件,在测试服务器能够发送邮件,但是在生产服务器不能发送邮件。 在生产服务器上发送邮件报异常 org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketTimeoutException: Read timed out. Failed messages: javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketTimeoutException: Read timed out; message exception details (1) are: Failed message 1: javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketTimeoutException: Read timed out at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2153) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1912) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638) at javax.mail.Service.connect(Service.java:295) at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:501) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:421) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:345) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:340) at com.service.impl.MailServiceImpl.sendMail(MailServiceImpl.java:217) at com.service.impl.MailServiceImpl$1.run(MailServiceImpl.java:78) Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(Unknown Source) at java.net.SocketInputStream.read(Unknown Source) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:110) at java.io.BufferedInputStream.fill(Unknown Source) at java.io.BufferedInputStream.read(Unknown Source) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:89) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2131) ... 9 more 2017-07-19 18:53:51,041 - {"errcode":"-500","errmsg":"Read timed out"} 生产服务器和测试服务器用的是同一个邮箱服务器上的邮箱。 另外,生产服务器和邮箱的服务器的通讯是正常的。 请问是为什么会出现这种情况?怎么判断?如何检测?如何修改?

javamail发送邮件失败问题?

这是报的异常:信息: Initializing c3p0 pool... com.mchange.v2.c3p0.ComboPooledDataSource [ acquireIncrement -> 3, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, dataSourceName -> z8kflt9u1dxx2q1feu2jv|1127b52, debugUnreturnedConnectionStackTraces -> false, description -> null, driverClass -> com.mysql.jdbc.Driver, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> z8kflt9u1dxx2q1feu2jv|1127b52, idleConnectionTestPeriod -> 0, initialPoolSize -> 3, jdbcUrl -> jdbc:mysql:///estoresystem, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 0, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 15, maxStatements -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 3, numHelperThreads -> 3, numThreadsAwaitingCheckoutDefaultUser -> 0, preferredTestQuery -> null, properties -> {user=******, password=******}, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false ] javax.mail.MessagingException: Unknown SMTP host: smtp.qq.com; nested exception is: java.net.UnknownHostException: smtp.qq.com at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1932) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:638) at javax.mail.Service.connect(Service.java:317) at javax.mail.Service.connect(Service.java:176) at javax.mail.Service.connect(Service.java:125) at javax.mail.Transport.send0(Transport.java:194) at javax.mail.Transport.send(Transport.java:124) at cn.itcast.estore.utils.MailUtils.sendMail(MailUtils.java:50) at cn.itcast.estore.service.UserServiceImpl.regist(UserServiceImpl.java:33) at cn.itcast.estore.web.servlet.UsersServlet.regist(UsersServlet.java:78) at cn.itcast.estore.web.servlet.UsersServlet.doGet(UsersServlet.java:32) at cn.itcast.estore.web.servlet.UsersServlet.doPost(UsersServlet.java:98) at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447) at java.lang.Thread.run(Thread.java:619) Caused by: java.net.UnknownHostException: smtp.qq.com at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366) at java.net.Socket.connect(Socket.java:519) at java.net.Socket.connect(Socket.java:469) at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:288) at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:231) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1900) ... 25 more 这是我写的一个工具类代码: public class MailUtils { public static void sendMail(String email, String emailMsg) throws AddressException, MessagingException { // 1.创建一个程序与邮件服务器会话对象 Session Properties props = new Properties(); props.setProperty("mail.transport.protocol", "SMTP"); props.setProperty("mail.host", "smtp.qq.com"); props.setProperty("mail.smtp.auth", "true");// 指定验证为true // 创建验证器 Authenticator auth = new Authenticator() { public PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication("312476956@qq.com", "SN19900103"); } }; Session session = Session.getInstance(props, auth); // 2.创建一个Message,它相当于是邮件内容 Message message = new MimeMessage(session); message.setFrom(new InternetAddress("312476956@qq.com")); // 设置发送者 message.setRecipient(RecipientType.TO, new InternetAddress(email)); // 设置发送方式与接收者 message.setSubject("用户激活"); // message.setText("这是一封激活邮件,请<a href='#'>点击</a>"); message.setContent(emailMsg, "text/html;charset=utf-8"); // 3.创建 Transport用于将邮件发送 Transport.send(message); } } 求大神们帮忙看一下?我感觉代码应该是没问题,是不是我哪里没开启什么服务还是什么其他的问题?

javaMail Imap 协议邮件搜索中文问题

![图片说明](https://img-ask.csdn.net/upload/201511/23/1448270328_581006.png) 如图, 2015-11-23 14:48:50,425 INFO org.xxx.xxx.xxx.mail.imap.ImapMailReceiver - connecting............. 2015-11-23 14:48:50,425 INFO org.xxx.xxx.xxx.mail.imap.ImapMailReceiver - folderName...INBOX-------param...我是好人-------- javax.mail.MessagingException: A4 BAD Command Argument Error. 11; nested exception is: com.sun.mail.iap.BadCommandException: A4 BAD Command Argument Error. 11 at com.sun.mail.imap.IMAPFolder.search(IMAPFolder.java:1881) 环境是exchange2007的server,开通的imap协议。程序端使用的是javamail ,用的search方法,测试了下新浪的可以支持中文,但是exchange这边就不支持中文但是英文可以走通。又遇到过的大神吗 支支招

Java Mail接收邮件连接超时异常

通过命令行telnet可以成功实现邮件的接收,但JavaMaik总是报连接超时的异常,代码如下: ``` @Controller public class ReceiveMailController { @RequestMapping(value ="/receiveMail", method = RequestMethod.GET) public void receiveMail(HttpServletRequest request) throws MessagingException, IOException { String host = "pop3.sina.com"; String port = "110"; String userName = "******@sina.com"; String password = "******"; Properties p = System.getProperties(); p.put("mail.store.protocol", "pop3"); p.put("mail.pop3.host", host); p.put("mail.pop3.port", port); p.put("mail.pop3.auth", "true");//需要邮件服务器认证 MailAuthenticator auth = new MailAuthenticator(userName, password); Session session = Session.getDefaultInstance(p, auth); try{ Store store = session.getStore("pop3"); store.connect(host, userName, password); Folder folder = store.getFolder("INBOX"); folder.open(Folder.READ_ONLY); Message msg[] = folder.getMessages(); //Integer msgCount = msg.length; for(int i = 0, msgCount = msg.length; i < msgCount; i++){ System.out.println("第"+i+"封邮件主题:"+msg[i].getSubject()); } folder.close(true); store.close(); System.out.println("Email received successfully!"); }catch(MessagingException e){ e.printStackTrace(); } } } ``` 异常: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: pop3.sina.com, 110; timeout -1; nested exception is: java.net.ConnectException: Connection timed out: connect at com.sun.mail.pop3.POP3Store.protocolConnect(POP3Store.java:211) at javax.mail.Service.connect(Service.java:364) at javax.mail.Service.connect(Service.java:245) 哪位大神能帮忙解答一下。

JavaMail不能连接smtp host

我现在想验证一下javamail的基本功能,遇到了javax.mail.MessagingException: Could not connect to SMTP host: smtp.163.com, port: 25;的问题,请大牛指点…… package com; import java.util.Properties; import javax.mail.Message; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; public class sendMail { public static void main(String args[]){ String host = "smtp.163.com"; String from = "fasong@163.com"; String to = "jieshou@163.com"; try{ Properties props = System.getProperties(); props.put("mail.smtp.host", host); Session session = Session.getDefaultInstance(props, null); MimeMessage message = new MimeMessage(session); //设置发件人 message.setFrom(new InternetAddress(from)); //设置收件人 message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); //设置消息主题 message.setSubject("你好 JavaMail"); //设置消息内容 message.setText("Welcome to JavaMail world!"); //发送消息 Transport.send(message); System.out.println("消息已经发送成功"); }catch(Exception e){ e.printStackTrace(); } } }

使用qq邮箱发送邮件出错Mail server connection failed

发送邮件失败,求解答 ``` Exception in thread "main" org.springframework.mail.MailSendException: Mail server connection failed; nested exception is javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketTimeoutException: Read timed out. Failed messages: javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketTimeoutException: Read timed out; message exception details (1) are: Failed message 1: javax.mail.MessagingException: Exception reading response; nested exception is: java.net.SocketTimeoutException: Read timed out at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2202) at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1939) at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:654) at javax.mail.Service.connect(Service.java:295) at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:501) at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:421) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:307) at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:296) at cn.cherish.common.MailUtil.main(MailUtil.java:44) Caused by: java.net.SocketTimeoutException: Read timed out at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.read(SocketInputStream.java:152) at java.net.SocketInputStream.read(SocketInputStream.java:122) at com.sun.mail.util.TraceInputStream.read(TraceInputStream.java:124) at java.io.BufferedInputStream.fill(BufferedInputStream.java:235) at java.io.BufferedInputStream.read(BufferedInputStream.java:254) at com.sun.mail.util.LineInputStream.readLine(LineInputStream.java:89) at com.sun.mail.smtp.SMTPTransport.readServerResponse(SMTPTransport.java:2182) ... 8 more ``` 代码如下: ``` public class MailUtil { public static void main(String args[]) { JavaMailSenderImpl senderImpl = new JavaMailSenderImpl(); // 设定mail server senderImpl.setHost("smtp.qq.com"); senderImpl.setProtocol("smtp"); senderImpl.setUsername("785427346@qq.com"); senderImpl.setPassword("xxxxxxxxx"); senderImpl.setPort(465); senderImpl.setDefaultEncoding("UTF-8"); // 建立邮件消息 SimpleMailMessage mailMessage = new SimpleMailMessage(); // 设置收件人,寄件人 用数组发送多个邮件 String[] array = new String[] {"xxxx@qq.com","yyyy@qq.com"}; mailMessage.setTo(array); mailMessage.setFrom("785427346@qq.com"); mailMessage.setSubject("测试简单文本邮件发送!"); mailMessage.setText("测试我的简单邮件发送机制!!"); Properties prop = new Properties(); prop.put("mail.smtp.auth", "true"); prop.put("mail.smtp.timeout", "25000"); senderImpl.setJavaMailProperties(prop); // 发送邮件 senderImpl.send(mailMessage); System.out.println(" 邮件发送成功.. "); } } ```

Springboot整合admin和security后,客户端报错o.s.b.actuate.mail.MailHealthIndicator : Mail health check failed

请问下: springboot整合admin服务端 server: port: 9002 spring: application: name: SpringBoot-Admin security: user: name: admin password: admin boot: admin: monitor: status-interval: 10000ms info-interval: 1m springboot整合Actuator、security、mail等web boot: admin: client: instance: name: springboot-web-client service-url: http://localhost:9001 metadata: user.name: ${spring.security.user.name} user.password: ${spring.security.user.password} url: http://localhost:9002 username: admin password: admin period: 10000ms connect-timeout: 5000ms read-timeout: 5000ms security: user: name: admin password: 123456 mail: host: smtp.qq.com port: 587 username: QQ邮箱 # 授权码 password: 授权码 protocol: smtp default-encoding: UTF-8 properties: mail: smtp: auth: true starttls: enable: true required: true 依赖和配置类都写了,然后启动两个服务后客户端报错 2020-02-12 13:10:16.587 WARN 8628 --- [nio-9001-exec-7] o.s.b.actuate.mail.MailHealthIndicator : Mail health check failed javax.mail.AuthenticationFailedException: 535 Login Fail. Please enter your authorization code to login. More information in http://service.mail.qq.com/cgi-bin/help?subtype=1&&id=28&&no=1001256 at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:947) ~[jakarta.mail-1.6.4.jar:1.6.4] at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:858) ~[jakarta.mail-1.6.4.jar:1.6.4] at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:762) ~[jakarta.mail-1.6.4.jar:1.6.4] at javax.mail.Service.connect(Service.java:342) ~[jakarta.mail-1.6.4.jar:1.6.4] at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:518) ~[spring-context-support-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.mail.javamail.JavaMailSenderImpl.testConnection(JavaMailSenderImpl.java:398) ~[spring-context-support-5.2.3.RELEASE.jar:5.2.3.RELEASE] at org.springframework.boot.actuate.mail.MailHealthIndicator.doHealthCheck(MailHealthIndicator.java:42) ~[spring-boot-actuator-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:82) ~[spring-boot-actuator-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.actuate.health.HealthIndicator.getHealth(HealthIndicator.java:37) [spring-boot-actuator-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.actuate.health.HealthEndpointWebExtension.getHealth(HealthEndpointWebExtension.java:95) [spring-boot-actuator-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.actuate.health.HealthEndpointWebExtension.getHealth(HealthEndpointWebExtension.java:43) [spring-boot-actuator-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.actuate.health.HealthEndpointSupport.getContribution(HealthEndpointSupport.java:108) [spring-boot-actuator-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.actuate.health.HealthEndpointSupport.getAggregateHealth(HealthEndpointSupport.java:119) [spring-boot-actuator-2.2.4.RELEASE.jar:2.2.4.RELEASE] at org.springframework.boot.actuate.health.HealthEndpointSupport.getContribution(HealthEndpointSupport.java:105) [spring-boot-actuator-2.2.4.RELEASE.jar:2.2.4.RELEASE]

javamail调用异常 imap

我要用使用imap 调用读取某邮箱,只要读邮件就可以了,现在卡在第一步,连接邮箱连接不到。跪求大牛。 代码如下: ![图片说明](https://img-ask.csdn.net/upload/201807/04/1530669220_503504.jpg) 报错如下: javax.mail.AuthenticationFailedException: AUTHENTICATE failed. at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:725) at javax.mail.Service.connect(Service.java:366) at javax.mail.Service.connect(Service.java:246) at javax.mail.Service.connect(Service.java:267) at com.mail.util.ImapFetchMail.main(ImapFetchMail.java:31)

JAVAMAIL问题,高手...,来来来

1,今天买了个企业邮箱 2,网上抄段程序用STMT可以发邮件 3,用POP3可以得到收件箱 4,我想的是用STMT发邮件后保存起来,得到一个FLODER对象把MESSAGE对象保存进去,提示javax.mail.MethodNotSupportedException: Append not supported 对于第4点不知道是我的程序乱写的,还是我没有写的权限 [b]问题补充:[/b] 我用的是万网的企业邮箱,不知道一般这个设置叫什么名称,我找不到.不过我有解决的方法就是给自己发邮件.当然了,有设置的话是最好的,一个设置就搞定.继续提问"一般这个设置叫什么名称?"

Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry

package com.gotobus.util.email; import java.util.Properties; import javax.mail.Message; import javax.mail.MessagingException; import javax.mail.SendFailedException; import javax.mail.Session; import javax.mail.Transport; import javax.mail.internet.AddressException; import javax.mail.internet.InternetAddress; import javax.mail.internet.MimeMessage; import com.sun.mail.smtp.SMTPAddressFailedException; public class SendMail { /** * @param args */ public static void main(String[] args) { String host = "mail.gotobus.com"; //发件人使用发邮件的电子信箱服务器 String from = "no-reply@gotobus.com"; //发邮件的出发地(发件人的信箱) String to = "wushu201404@gmail.com"; //发邮件的目的地(收件人信箱) // String to="mark@gotobus.com"; Properties props = System.getProperties(); props.put("mail.smtp.host", host); props.put("mail.smtp.auth", "false"); //这样才能通过验证 props.put("mail.transport.protocol", "POP3"); props.put("mail.smtp.port", "25"); // MyAuthenticator myauth = new MyAuthenticator(); Session session = Session.getDefaultInstance(props, null); // Session session = Session.getInstance(props); MimeMessage message = new MimeMessage(session); try { message.setFrom(new InternetAddress(from)); message.addRecipient(Message.RecipientType.TO, new InternetAddress(to)); message.setSubject("测试程序--no-reply--!"); message.setText("这是用java写的发送电子邮件的测试程序99999wwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwwa!"); message.saveChanges(); try { Transport.send(message); } catch (SMTPAddressFailedException e) { throw new SendFailedException("Unable to send to " + to, e); } System.out.println("=======success====="); } catch (AddressException e) { e.printStackTrace(); } catch (MessagingException e) { e.printStackTrace(); } } } ----具体情况描述-------- 这个案例是用javamail实现不需要校验身份信息实现邮件发送的功能,目前自己所用的是企业内部邮箱,代码可以实现的是给内部邮箱发件。但换成qq.163.gmail等邮件时,出现了上面的报错。。。。。。但使用perl语言时可以顺利转发,所以,邮箱账户应该不存在问题,求助大神诊断!!!!!!!!!!!!感激不尽!!

javamail 发送邮件 connection timeOut

javamail 发送邮件 connection timeOut , 这个超时时间是如何设置的,在哪里设置的? 应用部署环境 linux ,是不是linux系统本身有 tcp socket 的超时时间设置;还是javamail哪里有这个设置? 求解答。

学Python后到底能干什么?网友:我太难了

感觉全世界营销文都在推Python,但是找不到工作的话,又有哪个机构会站出来给我推荐工作? 笔者冷静分析多方数据,想跟大家说:关于超越老牌霸主Java,过去几年间Python一直都被寄予厚望。但是事实是虽然上升趋势,但是国内环境下,一时间是无法马上就超越Java的,也可以换句话说:超越Java只是时间问题罢。 太嚣张了会Python的人!找工作拿高薪这么简单? https://edu....

大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了

大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

为什么程序猿都不愿意去外包?

分享外包的组织架构,盈利模式,亲身经历,以及根据一些外包朋友的反馈,写了这篇文章 ,希望对正在找工作的老铁有所帮助

Java校招入职华为,半年后我跑路了

何来 我,一个双非本科弟弟,有幸在 19 届的秋招中得到前东家华为(以下简称 hw)的赏识,当时秋招签订就业协议,说是入了某 java bg,之后一系列组织架构调整原因等等让人无法理解的神操作,最终毕业前夕,被通知调往其他 bg 做嵌入式开发(纯 C 语言)。 由于已至于校招末尾,之前拿到的其他 offer 又无法再收回,一时感到无力回天,只得默默接受。 毕业后,直接入职开始了嵌入式苦旅,由于从未...

Java基础知识面试题(2020最新版)

文章目录Java概述何为编程什么是Javajdk1.5之后的三大版本JVM、JRE和JDK的关系什么是跨平台性?原理是什么Java语言有哪些特点什么是字节码?采用字节码的最大好处是什么什么是Java程序的主类?应用程序和小程序的主类有何不同?Java应用程序与小程序之间有那些差别?Java和C++的区别Oracle JDK 和 OpenJDK 的对比基础语法数据类型Java有哪些数据类型switc...

@程序员:GitHub这个项目快薅羊毛

今天下午在朋友圈看到很多人都在发github的羊毛,一时没明白是怎么回事。 后来上百度搜索了一下,原来真有这回事,毕竟资源主义的羊毛不少啊,1000刀刷爆了朋友圈!不知道你们的朋友圈有没有看到类似的消息。 这到底是啥情况? 微软开发者平台GitHub 的一个区块链项目 Handshake ,搞了一个招募新会员的活动,面向GitHub 上前 25万名开发者派送 4,246.99 HNS币,大约价...

用python打开电脑摄像头,并把图像传回qq邮箱【Pyinstaller打包】

前言: 如何悄悄的打开朋友的摄像头,看看她最近过的怎么样,嘿嘿!这次让我带你们来实现这个功能。 注: 这个程序仅限在朋友之间开玩笑,别去搞什么违法的事情哦。 代码 发送邮件 使用python内置的email模块即可完成。导入相应的代码封装为一个send函数,顺便导入需要导入的包 注: 下面的代码有三处要修改的地方,两处写的qq邮箱地址,还有一处写的qq邮箱授权码,不知道qq邮箱授权码的可以去百度一...

C++(继承):19---虚基类与虚继承(virtual)

一、菱形继承 在介绍虚继承之前介绍一下菱形继承 概念:A作为基类,B和C都继承与A。最后一个类D又继承于B和C,这样形式的继承称为菱形继承 菱形继承的缺点: 数据冗余:在D中会保存两份A的内容 访问不明确(二义性):因为D不知道是以B为中介去访问A还是以C为中介去访问A,因此在访问某些成员的时候会发生二义性 缺点的解决: 数据冗余:通过下面“虚继承”技术来解决(见下) 访问...

计算机网络——浅析网络层

一、前言 注意,关于ipv4和ipv6,ipv4是ip协议第4版本,也表示这个版本的ip一共4个字节,同样地,ipv6是ip协议第6版本,也表示这个版本的ip一共6个字节。 关于网络层使用路由器实现互联:在计算机网络的分层结构中,不同层有不同的中继设备: 计算机网络层 中继设备/中继系统 物理层 中继器、集线器Hub 数据链路层 网桥或交换机(交换机是多端口网桥,两者本质上是一个东西) 网络层 路...

我以为我学懂了数据结构,直到看了这个导图才发现,我错了

数据结构与算法思维导图

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

华为初面+综合面试(Java技术面)附上面试题

华为面试整体流程大致分为笔试,性格测试,面试,综合面试,回学校等结果。笔试来说,华为的难度较中等,选择题难度和网易腾讯差不多。最后的代码题,相比下来就简单很多,一共3道题目,前2题很容易就AC,题目已经记不太清楚,不过难度确实不大。最后一题最后提交的代码过了75%的样例,一直没有发现剩下的25%可能存在什么坑。 笔试部分太久远,我就不怎么回忆了。直接将面试。 面试 如果说腾讯的面试是挥金如土...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

女程序员,为什么比男程序员少???

昨天看到一档综艺节目,讨论了两个话题:(1)中国学生的数学成绩,平均下来看,会比国外好?为什么?(2)男生的数学成绩,平均下来看,会比女生好?为什么?同时,我又联想到了一个技术圈经常讨...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

女朋友过生日,我花了20分钟给她写了一个代理服务器

女朋友说:“看你最近挺辛苦的,我送你一个礼物吧。你看看想要什么,我来准备。” 我想了半天,从书到鞋子到电子产品最后到生活用品,感觉自己什么都不缺,然后和她说:“你省省钱吧,我什么都不需要。” 她坚持要送:“不行,你一定要说一个礼物,我想送你东西了。” 于是,我认真了起来,拿起手机,上淘宝逛了几分钟,但还是没能想出来缺点什么,最后实在没办法了:“这样吧,如果你实在想送东西,那你就写一个代理服务器吧”...

记一次腾讯面试,我挂在了最熟悉不过的队列上……

腾讯后台面试,面试官问:如何自己实现队列?

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

带了6个月的徒弟当了面试官,而身为高级工程师的我天天修Bug......

即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

HTTP与HTTPS的区别

面试官问HTTP与HTTPS的区别,我这样回答让他竖起大拇指!

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

终于懂了TCP和UDP协议区别

终于懂了TCP和UDP协议区别

Python爬虫,高清美图我全都要(彼岸桌面壁纸)

爬取彼岸桌面网站较为简单,用到了requests、lxml、Beautiful Soup4

立即提问
相关内容推荐