开发者

unable to send a file with <?xml> tag as an attachment using javamail

开发者 https://www.devze.com 2023-04-04 17:13 出处:网络
I am trying to write a stream to a file and send the file as an attachment to an email using JavaMail API.

I am trying to write a stream to a file and send the file as an attachment to an email using JavaMail API.

Some of the contents of the stream are as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUB开发者_StackOverflow社区LIC "-//Apple//DTD PLIST    1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
    <dict>
        <key>PayloadContent</key>
        <dict>
            <key>CAFingerprint</key>
            <data>
            t5B0m0Wy7QTk78bU1C0nQsU4yAo=
            </data>
            <key>Challenge</key>
            <string></string>
            <key>Key Type</key>
            <string>RSA</string>
            <key>Key Usage</key>
            <integer>0</integer>
            <key>Keysize</key>

If I remove the first line <?xml version="1.0" encoding="UTF-8"?> the contents are written to the file and the file is successfully sent as an attachment. <?xml version="1.0" encoding="UTF-8"?> in a blank file is sent as an attachment.

Please can someone guide as to why am I facing this issue.

0

精彩评论

暂无评论...
验证码 换一张
取 消