addImage.setOnClickListener(new View.OnClickListener() { public void onClick(View view) { Mail m = new Mail("gmailusername@gmail.com", "password"); m.setTo(toArr); m.setFrom("wooo@wooo.com"); m.setSubject("This is an email sent using my Mail JavaMail wrapper from an Android device."); m.setBody("Email body."); m.addAttachment("/sdcard/filelocation"); if(m.send()) { Toast.makeText(MailApp.this, "Email was sent successfully.", Toast.LENGTH_LONG).show(); } else {
@Override public MailTemplate text(String subject) { super.text(subject); return this; }
@Override public MailTemplate html(String subject) { super.html(subject); return this; }
for (InviteItem item : items) { Mail mail = new Mail("test@test.com", "MYPASSIFORGOTTOCHANGE"); to = ((com.plan.library.contact.Invite) item) .get_email(); invitees.add(to); String body = html.replace("<%EMAIL%>", to); mail.set_to(to); mail.set_from("test@test.com"); mail.set_subject(name + " has invited"); mail.set_body(body); result = mail.send(); mail = null; }
public void onPreExecute() { this.m = new Mail("user@gmail.com", ""); String[] toArr = {"bla@bla.com", "lala@lala.com"}; m.setTo(toArr); m.setFrom("wooo@wooo.com"); m.setSubject("This is an email sent using my Mail JavaMail wrapper from an Android device."); m.setBody("Email body."); } }
Mail m1 = new Mail(); Mail m2 = new Mail() XStream xstream = new XStream(); xstream.alias("brokermail",Mail.class); m1.setInvoiceReferenceNotificationMessage(invoiceReferenceNotificationMessage1); m2.setInvoiceReferenceNotificationMessage(invoiceReferenceNotificationMessage2); String abc1 = xstream.toXML(m1); String abc2 = xstream.toXML(m2);
@Override public MailTemplate subject(String subject) { super.subject(subject); return this; }
@Override public MailTemplate addAttachment(MailAttachment attachment) { super.addAttachment(attachment); return this; }
@Override public MailTemplate from(String from) { super.from(from); return this; }
@Override public MailTemplate to(String... to) { super.to(to); return this; }
@Override public MailTemplate bcc(String... bcc) { super.bcc(bcc); return this; }
@Override public MailTemplate cc(String... cc) { super.cc(cc); return this; }
Mail m = new Mail("from@gmail.com", "my password"); m.setTo(toArr); m.setFrom("from mail@gmail.com"); m.setSubject("Email from Android"); m.setBody("body."); if (BuildConfig.DEBUG) Log.v(SendEmailAsyncTask.class.getName(), "doInBackground()"); try { m.send(); return true; } catch (AuthenticationFailedException e) { return false; } catch (MessagingException e) { Log.e(SendEmailAsyncTask.class.getName(), m.getTo(null) + "failed"); e.printStackTrace(); return false;
public void onPreExecute() { m = new Mail("user@gmail.com", "");
Mail m1 = new Mail(); XStream xstream = new XStream(); xstream.alias("brokermail",Mail.class); m1.setInvoiceReferenceNotificationMessage(invoiceReferenceNotificationMessage1); String abc1 = xstream.toXML(m1); m1.setInvoiceReferenceNotificationMessage(invoiceReferenceNotificationMessage2); String abc2 = xstream.toXML(m1);
public static boolean sendEmail(String to, String from, String subject, String message,String[] attachements) throws Exception { Mail mail = new Mail(); if (subject != null && subject.length() > 0) { mail.setSubject(subject); } else { mail.setSubject("Subject"); } if (message != null && message.length() > 0) { mail.setBody(message); } else { mail.setBody("Message"); } mail.setTo(new String[] {to}); if (attachements != null) { for (String attachement : attachements) { mail.addAttachment(attachement); } } return mail.send(); }
public void onPreExecute() { m = new Mail("user@gmail.com", ""); ......
Mail m=new Mail("DefultUserID@gmail.com","XXXXXXX"); @SuppressWarnings("static-access") @Override setContentView(R.layout.email); String[] toArr = {"UserEmailID_1@gmail.com","UserEmail_ID@Yahoo.co.in"}; m.setTo(toArr); m.setFrom("AKASH"); m.setSubject("Your Subject"); m.setBody("Your Message body"); boolean i= m.send(); if(i==true){ Toast.makeText(getApplicationContext(),"Email was sent successfully ",2000).show();
Mail m = new Mail("gmailusername@gmail.com", "password");
new Mail("your email here", "your password here").send();