使用 smtp 在 javamail 中发送 hyper link 作为附件

Sending hyper link as attachment in javamail using smtp

我正在使用 javamail api 通过 smtp 发送电子邮件。

我试过tutorial point中的一个典型例子。

但是当我尝试将 hyper link(https://www.antennahouse.com/XSLsample/pdf/sample-link_1.pdf) 作为附件时,出现以下错误。

Caused by: java.io.FileNotFoundException: https:\www.antennahouse.com\XSLsample\pdf\sample-link_1.pdf (The filename, directory name, or volume label syntax is incorrect)

hyper link 作为附件是否有不同的方法?

已解决。

我使用 http 请求下载了文件并附加了它。