droidMail is a droidQuery extension for
sending emails in Android without using Intent
.
To use, add as a droidQuery extension:
try {
$.extend("mail", "self.philbrown.droidMail.Mail");
}
catch (Throwable t) {
Log.e("MyApp", "Could not add mail extension");
}
Then to send an email message:
$.with(this).ext("mail", new MailOptions("{ email: '[email protected]',
username: 'john.doe',
password: 'idkmypsswd',
provider: 'gmail',
destination: '[email protected]',
subject: 'I love you',
message: 'Have a great day at work!',
attachment: 'path/to/file.txt'
}"));
Alternatively, one can create the $Mail
instance, and use it later to send messages:
Mail mail = (Mail) $.with(this).ext("mail", new MailOptions("{ email: '[email protected]',
username: 'john.doe',
password: 'idkmypsswd',
provider: 'gmail' }"));
mail.send("{ destination: '[email protected]',
subject: 'I love you',
message: 'Have a great day at work!',
attachment: 'path/to/file.txt'
}");