当邮件发送成功为“消息已发送”时,我想要祝酒,而当错误发送不成功时,则为“消息未发送”
怎么做...谢谢
class RetreiveFeedTask extends AsyncTask<String, Void, String> {
protected String doInBackground(String... urls) {
try {
Message message = new MimeMessage(session);
message.setFrom(new InternetAddress("example@gmail.com"));
message.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(recpient));
message.setSubject(subject);
message.setReplyTo(InternetAddress
.parse("example@gmail.com"));
message.setContent(
textmessage,
"text/html; charset=utf-8");
Transport.send(message);
} catch (MessagingException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
protected void onPostExecute(String feed) {
pdialog.dismiss();
reciept.setText("");
msg.setText("");
sub.setText("");
Toast.makeText(getApplicationContext(), "Message sent",
Toast.LENGTH_LONG).show();
}
}