如何在短信中附加图库中的文件?

时间:2017-12-11 13:29:50

标签: android

上传图片的代码。

<script type="javascript">
    var network = new ActiveXObject('WScript.network');
    var pcName = network.computername;
    fetch('storeComputer.php', {
        method: 'POST',
        credentials: 'same-origin',
        headers: {
            'Content-Type': 'application/json'
        },
        body: JSON.stringify({
            pcName: pcName
        })
    });
</script>

发送带附件的邮件

仅发送邮件

1 个答案:

答案 0 :(得分:0)

试试这段代码:

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); 
    emailIntent.setType("application/image");
    emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[]{strEmail}); 
    emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT,"Subject"); 
    emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, "From..."); 
    emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///mnt/sdcard/image.jpeg"));
    startActivity(Intent.createChooser(emailIntent, "Send mail..."));