Java mail, set reply-to address not working

后端 未结 2 468
北荒
北荒 2021-02-13 01:43

I wrote a small email sending program in java, it has from, to and reply-to address, when the client tries to reply to the mail, it should

相关标签:
2条回答
  • 2021-02-13 01:53

    Try:

    MimeMessage message = new MimeMessage(session);
    message.setReplyTo(new javax.mail.Address[]
    {
        new javax.mail.internet.InternetAddress("mnop@gmail.com")
    });
    
    0 讨论(0)
  • 2021-02-13 02:02

    Message.setReplyTo()?

    Please note that:

    • "from" is not the same as "reply to"
    • according to the spec, the property for from-address is "mail.from"
    • the documentation for getDefaultInstance specifies that this only creates a new instance if there isn't an existing default instance and the properties are only used when creating a new instance. Further, the default instance is a global value and will be re-used, so unless you want the same "from"-address on all your email, you need to create new sessions (using getInstance())
    0 讨论(0)
提交回复
热议问题