MailOtto是一个邮件工具。
邮件
public class Mail { public Class<?> from; public Class<?> to; public Object content; public Mail(Class<?> to, Object content) { this(null, to, content); } public Mail(Class<?> from, Class<?> to, Object content) { this.to = to; this.from = from; this.content = content; } }
发送邮件
RxMail.getInstance().send(mail);
检查邮件
RxMail.getInstance().checkMails(this);
接收邮件
// Must be set before checkMails RxMail.getInstance().toObserverable().subscribe(new Action1<Object>() { @Override public void call(Object event) { if (event instanceof Mail) { Toast.makeText(this, ((Mail) event).content.toString(), Toast.LENGTH_SHORT).show(); } } });