Sending an email with an attachment using javamail API

后端 未结 5 976
遥遥无期
遥遥无期 2020-12-06 12:10

I am trying to send an email with an attachment file in Java.

When I send the email without an attachment I receive the email, but when I add the attachment I don\'t

5条回答
  •  南方客
    南方客 (楼主)
    2020-12-06 12:31

    See the JavaMail FAQ for debugging tips. In particular, the protocol trace will tell you more about what's going on in each case. While you're there you'll find tips for using GMail as well.

    If the only difference is really just the addition of an attachment, it seems unlikely that it's an authentication problem. You may be getting an exception that you're not noticing since your send method is declared to throw MessagingException.

提交回复
热议问题