java.net.UnknownHostException和javax.mail.MessagingException的问题

问题描述

javax.mail.MessagingException:UnknownSMTPhost:mail02.secpg.com;nestedexceptionis:java.net.UnknownHostException:mail02.secpg.comatcom.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1225)atcom.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:322)atjavax.mail.Service.connect(Service.java:236)atjavax.mail.Service.connect(Service.java:137)atjavax.mail.Service.connect(Service.java:86)atjavax.mail.Transport.send0(Transport.java:150)atjavax.mail.Transport.send(Transport.java:80)atcn.edu.tongji.cims.wade.peoplemanagement.EmailSender.sendMail(EmailSender.java:268)atcn.edu.tongji.cims.wade.navigator.AddProjectDialog$6$1.run(AddProjectDialog.java:850)atorg.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)atorg.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:123)atorg.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:3325)atorg.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2971)atorg.eclipse.jface.operation.ModalContext$ModalContextThread.block(ModalContext.java:158)atorg.eclipse.jface.operation.ModalContext.run(ModalContext.java:326)atorg.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:479)atcn.edu.tongji.cims.wade.navigator.AddProjectDialog.buttonPressed(AddProjectDialog.java:430)atorg.eclipse.jface.dialogs.Dialog$3.widgetSelected(Dialog.java:660)atorg.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:90)atorg.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)atorg.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)atorg.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)atorg.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)atorg.eclipse.jface.window.Window.runEventLoop(Window.java:820)atorg.eclipse.jface.window.Window.open(Window.java:796)atcn.edu.tongji.cims.wade.action.CreateProjectAction$1.run(CreateProjectAction.java:59)atorg.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:67)atcn.edu.tongji.cims.wade.action.CreateProjectAction.run(CreateProjectAction.java:46)atorg.eclipse.jface.action.Action.runWithEvent(Action.java:499)atorg.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:539)atorg.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:488)atorg.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:400)atorg.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)atorg.eclipse.swt.widgets.Widget.sendEvent(Widget.java:928)atorg.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3348)atorg.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2968)atorg.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1930)atorg.eclipse.ui.internal.Workbench.runUI(Workbench.java:1894)atorg.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:422)atorg.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)atcn.edu.tongji.cims.wade.Application.run(Application.java:27)atorg.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:78)atorg.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:92)atorg.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:68)atorg.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:400)atorg.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:177)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(UnknownSource)atsun.reflect.DelegatingMethodAccessorImpl.invoke(UnknownSource)atjava.lang.reflect.Method.invoke(UnknownSource)atorg.eclipse.core.launcher.Main.invokeFramework(Main.java:336)atorg.eclipse.core.launcher.Main.basicRun(Main.java:280)atorg.eclipse.core.launcher.Main.run(Main.java:977)atorg.eclipse.core.launcher.Main.main(Main.java:952)有哪位大牛能给解释一下这些异常什么意思???

解决方案

解决方案二:
问题都说明了:"未知的主机异常"--smtp识别不了这个主机javax.mail.MessagingException:UnknownSMTPhost:mail02.secpg.com;nestedexceptionis:java.net.UnknownHostException:mail02.secpg.com一般主机是这样的smpt.gmail.com或smpt.qq.com,smpt.163.com每一种主机都有端口的,都可以再网站查到.普遍是25,但gmail是个特殊的Lz的mail02.secpg.com没见过
解决方案三:
smtp端口的问题?建议楼主去异常网去查查

时间: 2024-09-09 14:58:28

java.net.UnknownHostException和javax.mail.MessagingException的问题的相关文章

java mail出现 javax.mail.MessagingException: QUOTA not supported;

问题描述 在邮件调试quota过程中获取:Quota[]quotas=imapStore.getQuota("INBOX");抛出异常:javax.mail.MessagingException:QUOTAnotsupported;nestedexceptionis:com.sun.mail.iap.BadCommandException:GETQUOTAROOTnotsupportedatcom.sun.mail.imap.IMAPStore.getQuota(IMAPStore.j

javamail imap 网易邮箱打开文件夹时报错:javax.mail.MessagingException: A4 NO EXAMINE The lo

问题描述 Sessionsession=Session.getInstance(props,null);imap连接代码:Propertiesprops=getProperties();props.setProperty("mail.imap.host",host);props.setProperty("mail.imap.port",""+port);props.setProperty("mail.imap.auth.login.di

javax.mail.MessagingException: Connection dropped by server?;错误怎么解决

问题描述 大家好,我用javamail编写一个收邮件的软件,但是连接服务器时出现问题,出现以下提示错误(事先声明,地址,帐户,密码,端口都没有问题)邮箱服务器用的是microsoftexchange,谢谢:javax.mail.MessagingException:Connectiondroppedbyserver?;nestedexceptionis:java.io.IOException:Connectiondroppedbyserver?atcom.sun.mail.imap.IMAPSt

javax.mail.MessagingException: must use username as From authenticated! (#5.7.1)

问题描述 求此问题的详细解释,及解决方法,不胜感激 问题补充:哦,谢谢了liguangwen 写道 解决方案 报错的意思 登陆邮箱的验证名和发件人姓名必须一致对下 登录名跟发件人名是不是不一样了解决方案二:报错的意思:登陆邮箱的验证名和发件人姓名必须一致

java使用spring实现发送mail的方法_java

本文实例讲述了java使用spring实现发送mail的方法.分享给大家供大家参考.具体如下: 这里借鉴别人的优点以及自己的一些加工,写出如下代码: package test; import java.util.Properties; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; import org.springframework.mail.SimpleMailMessage; imp

java发送javax.mail邮件实例讲解_java

平时我们网上逛网站的时候,经常会用到网站的注册.有很多方法,比如发短信验证,发邮箱验证.最近在SSH框架下,做了一个简单的邮件发送激活链接到邮箱,然后激活注册用户的一个功能.我用到的MailServer是易邮邮件服务器,引用的是javax.mail.jar包.javamail顾名思义,提供给开发者处理电子邮件相关的编程接口.它是Sun发布的用来处理email的API.它可以方便地执行一些常用的邮件传输. [常用类介绍] 下面有一些常用的类,给大家介绍一下: [Authenticator]    

javase-关于Javax.mail的554异常

问题描述 关于Javax.mail的554异常 import java.io.File; import java.util.List; import java.util.Properties; import javax.activation.DataHandler; import javax.activation.FileDataSource; import javax.mail.BodyPart; import javax.mail.MessagingException; import jav

javax.mail发送邮件带附件

废话不多说直接上代码 package test; import java.io.File; import java.util.Properties; import javax.mail.Authenticator; import javax.mail.Message; import javax.mail.Message.RecipientType; import javax.mail.PasswordAuthentication; import javax.mail.Session; impor

Java发送邮件javax.mail的实现方法_java

直接上源码:1. 邮件的基本信息(方便就直接设置为静态了) 下面最好是做为一个javabean package com.lgf.Email; import java.util.Date; public class EmailMessage { /** * 邮件的信息,可以自己进行设置. * 为了方便直接全部设置为静态 */ // 收件人邮箱 public static String TO = "xxx@xxx.com"; // 发件人邮箱 public static String FR