I had a mail function in my application that was working fine until today, and I have not touched in about a month.
Here is a link to the mail program I put in my app: http://www.jondev.net/articles/Sending_Emails_without_User_Intervention_%28no_Intents%29_in_Android
My problem is in the conditional, m.send() is not being called for some reason, but the else statement is working fine. I am getting no errors at all and the catch is not catching anything. Can someone please tell me what happened to my program?
public void Mailing(String inputName, String inputPassword)
{
Mail m = new Mail(inputName, inputPassword);
String[] toArr = {"fake@gmail.com"};
m.setTo(toArr);
m.setFrom(inputName);
m.setSubject("Daily Time Card");
m.setBody("");
try
{
m.addAttachment(Environment.getExternalStorageDirectory().toString() + "/test");
if(m.send())
{
Toast.makeText(TaskReminderActivity.this, "Email was sent successfully.", Toast.LENGTH_LONG).show();
}
else
{
Toast.makeText(TaskReminderActivity.this, "Email was not sent successfully.", Toast.LENGTH_LONG).show();
}
} catch(Exception e) {
Toast.makeText(TaskReminderActivity.this, "There was a problem sending the email.", Toast.LENGTH_LONG).show();
Toast.makeText(TaskReminderActivity.this, "Value of User Name is " + inputName, Toast.LENGTH_LONG).show();
Toast.makeText(TaskReminderActivity.this, "Value of Password is " + inputPassword, Toast.LENGTH_LONG).show();
Toast.makeText(TaskReminderActivity.this, "Value of Attachment is " + Environment.getExternalStorageDirectory().toString() + "/test.txt", Toast.LENGTH_LONG).show();
Log.e("MailApp", "Could not send email", e);
}
}