小编Nag*_*S R的帖子

无法使用SMTP发送电子邮件(获取javax.mail.MessagingException:无法将套接字转换为TLS;)

我编写了以下代码,用于通过SMTP作为TLS使用javamail API发送电子邮件,因为不支持SSL,但我最终遇到以下异常.请参阅下面的代码.我使用过调试模式,在代码下面你也可以找到异常.

import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class SendMailTLS {

    public static void main(String[] args) {

        final String username = "---------@mydomain.com";
        final String password = "***********";

        Properties props = new Properties();
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.host", "mail.mydomain.com");
        props.put("mail.smtp.debug", "true");
        props.put("mail.smtp.port", "587");

        Session session = Session.getInstance(props,
          new javax.mail.Authenticator() {
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(username, password);
            }
          });
        session.setDebug(true);

        try {

            Message message = new MimeMessage(session);
            message.setFrom(new 
                  InternetAddress("---------@mydomain.com")); …
Run Code Online (Sandbox Code Playgroud)

java ssl smtp jakarta-mail

15
推荐指数
2
解决办法
7万
查看次数

`10/2`评价为'42279.00`?

在Excel中,我将单元格值作为数字格式10/2.它显示为10/2但我想5.00.

它评估5.00我是否=在它之前添加,即,=10/2但我不想编辑该列的大约500行.

我尝试使用VALUE函数,但它将其计算为42279.00:

细胞B1 10/2
细胞B242279.00

另一个数据示例是:100/20.

你能否告诉我出了什么问题,或者有没有办法让细胞值得10/2到评估5.00

string excel formatting worksheet-function excel-formula

0
推荐指数
1
解决办法
76
查看次数