Android: Using Email Intent To Send Email, Possible To Alter Message Just Before Sending?
I'm using: Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND); to send email, I need to add some footer to the message, is there any listener or some way that I c
Solution 1:
If the email is sent from your own app, then you will need to add the footer before firing the intent.
If the email is sent using any other app (including the default email app), then no, you won't be able to modify it.
EDIT:
In the case above, you will just need to append the signature to the message
string, any time before the line
if (message != null) emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, message);
Solution 2:
@Override
publicboolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.startsWith("mailto:")) {
try {
Intent emailIntent = new Intent(Intent.ACTION_SEND, Uri.parse(url));
emailIntent.setType("message/rfc822");
String recipient = url.substring( url.indexOf(":")+1 );
if (TextUtils.isEmpty(recipient)) recipient = "loco@wareninja.com";
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, newString[]{recipient});
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, mContext.getString(R.string.email_subject));
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, mContext.getString(R.string.email_message, " "));
mContext.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}
catch (Exception ex) {}
}
returntrue;
}
Solution 3:
You could..
Create a form in your own app with To, Subject, and Text TextEdit fields.
Save those user inputs as String variables.
Append/edit String variables
Pass the finalized variables into your emailIntent.putExtra()'s
Then, your users can decide if they like the changes or not, and just press send.
Post a Comment for "Android: Using Email Intent To Send Email, Possible To Alter Message Just Before Sending?"