我正在网上搜索从我的Java桌面应用程序导出数据到Excel的答案,我遇到了Apache POI API.然后我发现JDBC可以工作,然后我偶然发现了JExcel.它们都同样好,还是我应该专注于其中最好的,哪个是它?
干杯.
好吧,我不知道还能做什么。一周前,当我编写和测试它时,这段代码运行得非常好。然后我将它嵌入到我的程序中并意识到我不断收到异常。一切似乎都很正常。发件人地址合法。我用来测试它的收件人地址是合法的。怎么了?我很沮丧:
private String outgoingMailServer = "smtp.mail.yahoo.com";
boolean debug = true;
//set the host outgoing mail smtp server.
Properties properties = new Properties();
properties.put("mail.smtp.host", outgoingMailServer);
properties.put("mail.smtp.auth", "true");
Authenticator authenticator = new SMTPAuthentication();
Session session = Session.getDefaultInstance(properties, authenticator);
session.setDebug(debug);
//create a message session
Message msg = new MimeMessage(session);
//set the addresses, to and from
InternetAddress fromAddress;
fromAddress = new InternetAddress(emailFromAddress);
msg.setFrom(fromAddress);
//since mail can be sent to more than one recipient, create loop
//to add all addresses into InternetAddress, addressTo.
//InternetAddress[] toAddress …
Run Code Online (Sandbox Code Playgroud)