List of usage examples for android.content Intent EXTRA_CC
String EXTRA_CC
To view the source code for android.content Intent EXTRA_CC.
Click Source Link
From source file:Main.java
public static Intent newEmailIntent(String toAddress, String subject, String body, String cc) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { toAddress }); intent.putExtra(Intent.EXTRA_TEXT, body); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_CC, cc); intent.setType("message/rfc822"); return intent; }
From source file:Main.java
public static Intent newEmailIntent(Context context, String address, String subject, String body, String cc) { Intent intent = new Intent(Intent.ACTION_SEND); intent.putExtra(Intent.EXTRA_EMAIL, new String[] { address }); intent.putExtra(Intent.EXTRA_TEXT, body); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_CC, cc); intent.setType("message/rfc822"); return intent; }
From source file:Main.java
public static void sendEmail(Context ctx, String[] emailAddresses, String[] CCAddresses, String subject, String message) {/*from w w w .j av a 2 s.c o m*/ Intent emailIntent = new Intent(Intent.ACTION_SEND); // emailIntent.setType("text/plain"); emailIntent.setData(Uri.parse("mailto:")); String[] to = emailAddresses; String[] cc = CCAddresses; emailIntent.putExtra(Intent.EXTRA_EMAIL, to); if (CCAddresses != null) { emailIntent.putExtra(Intent.EXTRA_CC, cc); } emailIntent.putExtra(Intent.EXTRA_SUBJECT, subject); emailIntent.putExtra(Intent.EXTRA_TEXT, message); emailIntent.setType("message/rfc822"); ctx.startActivity(Intent.createChooser(emailIntent, "Email")); }
From source file:com.mmga.litedo.activity.SettingsActivity.java
private void sendEmail() { Uri uri = Uri.parse("mailto:1034752946@qq.com"); String[] email = { "1034752946@qq.com" }; Intent intent = new Intent(Intent.ACTION_SENDTO, uri); intent.putExtra(Intent.EXTRA_CC, email); // ? intent.putExtra(Intent.EXTRA_SUBJECT, ""); // intent.putExtra(Intent.EXTRA_TEXT, ""); // startActivity(Intent.createChooser(intent, "")); }
From source file:at.wada811.utils.IntentUtils.java
/** * ??Intent??/*from w w w .j a va 2 s . co m*/ * * @param mailto * @param cc * @param bcc * @param subject * @param body */ public static Intent createSendMailIntent(String[] mailto, String[] cc, String[] bcc, String subject, String body) { Intent intent = new Intent(Intent.ACTION_SEND); intent.setType(HTTP.PLAIN_TEXT_TYPE); intent.putExtra(Intent.EXTRA_EMAIL, mailto); intent.putExtra(Intent.EXTRA_CC, cc); intent.putExtra(Intent.EXTRA_BCC, bcc); intent.putExtra(Intent.EXTRA_SUBJECT, subject); intent.putExtra(Intent.EXTRA_TEXT, body); return intent; }
From source file:de.grobox.blitzmail.SendActivity.java
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // before doing anything show notification about sending process mNotifyManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); mBuilder = new NotificationCompat.Builder(this); mBuilder.setContentTitle(getString(R.string.sending_mail)).setContentText(getString(R.string.please_wait)) .setSmallIcon(R.drawable.notification_icon).setOngoing(true); // Sets an activity indicator for an operation of indeterminate length mBuilder.setProgress(0, 0, true);/*w w w .java 2 s .c om*/ // Create Pending Intent notifyIntent = new Intent(this, NotificationHandlerActivity.class); notifyIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notifyIntent, PendingIntent.FLAG_UPDATE_CURRENT); mBuilder.setContentIntent(pendingIntent); // Issues the notification mNotifyManager.notify(0, mBuilder.build()); Properties prefs; try { prefs = getPrefs(); } catch (Exception e) { String msg = e.getMessage(); Log.i("SendActivity", "ERROR: " + msg, e); if (e.getClass().getCanonicalName().equals("java.lang.RuntimeException") && e.getCause() != null && e.getCause().getClass().getCanonicalName().equals("javax.crypto.BadPaddingException")) { msg = getString(R.string.error_decrypt); } showError(msg); return; } // get and handle Intent Intent intent = getIntent(); String action = intent.getAction(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (action.equals(Intent.ACTION_SEND)) { String text = intent.getStringExtra(Intent.EXTRA_TEXT); //String email = intent.getStringExtra(Intent.EXTRA_EMAIL); String subject = intent.getStringExtra(Intent.EXTRA_SUBJECT); String cc = intent.getStringExtra(Intent.EXTRA_CC); String bcc = intent.getStringExtra(Intent.EXTRA_BCC); // Check for empty content if (subject == null && text != null) { // cut all characters from subject after the 128th subject = text.substring(0, (text.length() < 128) ? text.length() : 128); // remove line breaks from subject subject = subject.replace("\n", " ").replace("\r", " "); } else if (subject != null && text == null) { text = subject; } else if (subject == null && text == null) { Log.e("Instant Mail", "Did not send mail, because subject and body empty."); showError(getString(R.string.error_no_body_no_subject)); return; } // create JSON object with mail information mMail = new JSONObject(); try { mMail.put("id", String.valueOf(new Date().getTime())); mMail.put("body", text); mMail.put("subject", subject); mMail.put("cc", cc); mMail.put("bcc", bcc); } catch (JSONException e) { e.printStackTrace(); } // remember mail for later MailStorage.saveMail(this, mMail); // pass mail on to notification dialog class notifyIntent.putExtra("mail", mMail.toString()); // Start Mail Task AsyncMailTask mail = new AsyncMailTask(this, prefs, mMail); mail.execute(); } else if (action.equals("BlitzMailReSend")) { try { mMail = new JSONObject(intent.getStringExtra("mail")); } catch (JSONException e) { e.printStackTrace(); } // pass mail on to notification dialog class notifyIntent.putExtra("mail", mMail.toString()); // Start Mail Task AsyncMailTask mail = new AsyncMailTask(this, prefs, mMail); mail.execute(); } finish(); }
From source file:com.wit.android.support.content.intent.EmailIntent.java
/** *//*from w w w. j a va 2s . c om*/ @Nullable @Override public Intent buildIntent() { if (mEmails == null || mEmails.size() == 0) { Log.e(TAG, "Can not create an EMAIL intent. No e-mail address/-es specified."); return null; } /** * Build the intent. */ final Intent intent = new Intent(Intent.ACTION_SENDTO, createEmailUri(mEmails)); intent.putExtra(Intent.EXTRA_SUBJECT, mSubject); intent.putExtra(Intent.EXTRA_TEXT, mMessage); if (mCcEmails != null) { intent.putExtra(Intent.EXTRA_CC, mCcEmails.toArray()); } if (mccEmails != null) { intent.putExtra(Intent.EXTRA_BCC, mccEmails.toArray()); } return intent; }
From source file:org.apache.cordova.EmailComposer.java
private void sendEmail(JSONObject parameters) { final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); // String callback = parameters.getString("callback"); System.out.println(parameters.toString()); boolean isHTML = false; try {//w ww . ja va 2 s .co m isHTML = parameters.getBoolean("bIsHTML"); } catch (Exception e) { LOG.e("EmailComposer", "Error handling isHTML param: " + e.toString()); } if (isHTML) { emailIntent.setType("text/html"); } else { emailIntent.setType("text/plain"); } // setting subject try { String subject = parameters.getString("subject"); if (subject != null && subject.length() > 0) { emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject); } } catch (Exception e) { LOG.e("EmailComposer", "Error handling subject param: " + e.toString()); } // setting body try { String body = parameters.getString("body"); if (body != null && body.length() > 0) { if (isHTML) { emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, Html.fromHtml(body)); } else { emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, body); } } } catch (Exception e) { LOG.e("EmailComposer", "Error handling body param: " + e.toString()); } // setting TO recipients try { JSONArray toRecipients = parameters.getJSONArray("toRecipients"); if (toRecipients != null && toRecipients.length() > 0) { String[] to = new String[toRecipients.length()]; for (int i = 0; i < toRecipients.length(); i++) { to[i] = toRecipients.getString(i); } emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, to); } } catch (Exception e) { LOG.e("EmailComposer", "Error handling toRecipients param: " + e.toString()); } // setting CC recipients try { JSONArray ccRecipients = parameters.getJSONArray("ccRecipients"); if (ccRecipients != null && ccRecipients.length() > 0) { String[] cc = new String[ccRecipients.length()]; for (int i = 0; i < ccRecipients.length(); i++) { cc[i] = ccRecipients.getString(i); } emailIntent.putExtra(android.content.Intent.EXTRA_CC, cc); } } catch (Exception e) { LOG.e("EmailComposer", "Error handling ccRecipients param: " + e.toString()); } // setting BCC recipients try { JSONArray bccRecipients = parameters.getJSONArray("bccRecipients"); if (bccRecipients != null && bccRecipients.length() > 0) { String[] bcc = new String[bccRecipients.length()]; for (int i = 0; i < bccRecipients.length(); i++) { bcc[i] = bccRecipients.getString(i); } emailIntent.putExtra(android.content.Intent.EXTRA_BCC, bcc); } } catch (Exception e) { LOG.e("EmailComposer", "Error handling bccRecipients param: " + e.toString()); } // setting attachments try { JSONArray attachments = parameters.getJSONArray("attachments"); if (attachments != null && attachments.length() > 0) { ArrayList<Uri> uris = new ArrayList<Uri>(); // convert from paths to Android friendly Parcelable Uri's for (int i = 0; i < attachments.length(); i++) { try { File file = new File(attachments.getString(i)); if (file.exists()) { Uri uri = Uri.fromFile(file); uris.add(uri); } } catch (Exception e) { LOG.e("EmailComposer", "Error adding an attachment: " + e.toString()); } } if (uris.size() > 0) { emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); } } } catch (Exception e) { LOG.e("EmailComposer", "Error handling attachments param: " + e.toString()); } this.cordova.startActivityForResult(this, emailIntent, 0); }
From source file:de.appplant.cordova.plugin.emailcomposer.EmailComposer.java
/** * Setzt die CC-Empfnger der Mail./*from ww w . j a v a2 s . c o m*/ */ private void setCcRecipients(JSONArray ccRecipients, Intent draft) throws JSONException { String[] receivers = new String[ccRecipients.length()]; for (int i = 0; i < ccRecipients.length(); i++) { receivers[i] = ccRecipients.getString(i); } draft.putExtra(android.content.Intent.EXTRA_CC, receivers); }
From source file:de.appplant.cordova.emailcomposer.EmailComposerImpl.java
/** * Setter for the cc recipients./*from w w w . j a v a2 s. com*/ * * @param recipients * List of email addresses. * @param draft * The intent to send. * @throws JSONException */ private void setCcRecipients(JSONArray recipients, Intent draft) throws JSONException { String[] receivers = new String[recipients.length()]; for (int i = 0; i < recipients.length(); i++) { receivers[i] = recipients.getString(i); } draft.putExtra(Intent.EXTRA_CC, receivers); }