Fixed sending with attachments

This commit is contained in:
M66B
2018-08-23 18:58:21 +00:00
parent 190daefe0e
commit 83cfee5711
2 changed files with 25 additions and 1 deletions

View File

@@ -34,8 +34,13 @@ import android.widget.Spinner;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import javax.mail.Address;
@@ -137,4 +142,21 @@ public class Helper {
a[0] = a[0].split("\\+")[0];
return TextUtils.join("@", a);
}
static void copy(File src, File dst) throws IOException {
InputStream in = new FileInputStream(src);
try {
OutputStream out = new FileOutputStream(dst);
try {
byte[] buf = new byte[4096];
int len;
while ((len = in.read(buf)) > 0)
out.write(buf, 0, len);
} finally {
out.close();
}
} finally {
in.close();
}
}
}