我設法在我的Android應用程序中發送電子郵件;但是,我不知道如何在我的電子郵件中附加圖片。 我該怎麼做?從Android發送電子郵件時附加圖片
public MailSender(String user, String password, final Context context) {
this.user = user;
this.password = password;
this.context = context;
this.bckMng = BackgroundManager.getInstance(context);
Properties props = new Properties();
props.setProperty("mail.transport.protocol", "smtp");
props.setProperty("mail.host", mailhost);
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class",
"javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.socketFactory.fallback", "false");
props.setProperty("mail.smtp.quitwait", "false");
session = Session.getDefaultInstance(props, new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
String userName = context.getResources().getString(R.string.source_username);
String password = context.getResources().getString(R.string.source_password);
return new PasswordAuthentication(userName, password);
}
});
}
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(user, password);
}
在this.bckmng.getImages()我能得到的圖片...