我知道我们可以如下设置文件系统中的文件或链接到MimeMessage作为附件。
private void RequestMultiplePermission() {
// Creating String Array with Permissions.
ActivityCompat.requestPermissions(LoginActivity.this, new String[]
{
CALL_PHONE,
READ_PHONE_STATE
}, RequestPermissionCode);
}
public void onRequestPermissionsResult(int requestCode, String permissions[], int[] grantResults) {
switch (requestCode) {
case RequestPermissionCode:
if (grantResults.length > 0) {
boolean GetCallPermission = grantResults[0] == PackageManager.PERMISSION_GRANTED;
boolean GetReadphoneper = grantResults[1] == PackageManager.PERMISSION_GRANTED;
if (GetCallPermission && GetReadphoneper) {
Toast.makeText(LoginActivity.this, "Permission Granted", Toast.LENGTH_LONG).show();
}
else {
///Toast.makeText(Login.this,"Permission Granted",Toast.LENGTH_LONG).show();
}
}
break;
}
}
但是我想知道是否可以直接将java对象的内容设置为MimeMessage的附件。我有代表电子邮件附件的附件java类。我需要将附件对象主体设置为MimeMessage。请帮忙。