All Projects → teprinciple → Mailsender

teprinciple / Mailsender

Android快速实现发送邮件

Programming Languages

kotlin
9241 projects

Labels

Projects that are alternatives of or similar to Mailsender

Msgviewer
MsgViewer is email-viewer utility for .msg e-mail messages, implemented in pure Java. MsgViewer works on Windows/Linux/Mac Platforms. Also provides a java api to read mail messges (msg files) programmatically.
Stars: ✭ 61 (-50.41%)
Mutual labels:  mail
Jamspymer
SMS, Call, Mail, Telegram бомбер с открытым исходным кодом
Stars: ✭ 95 (-22.76%)
Mutual labels:  mail
Action Send Mail
⚙️ A GitHub Action to send an email to multiple recipients
Stars: ✭ 111 (-9.76%)
Mutual labels:  mail
Nice Mail
💌 Nice Mail 是一款以 Markdown 为基础的邮件编辑器。
Stars: ✭ 69 (-43.9%)
Mutual labels:  mail
Go Imap
📥 An IMAP library for clients and servers
Stars: ✭ 1,217 (+889.43%)
Mutual labels:  mail
Ansible Postfix
Ansible role to set up postfix in Debian-like systems
Stars: ✭ 102 (-17.07%)
Mutual labels:  mail
Hedwig
Send email to any SMTP server like a boss, in Swift and cross-platform
Stars: ✭ 1,096 (+791.06%)
Mutual labels:  mail
N1 Ido
Ido is a clean, simple, Polymail-inspired theme for Mailspring
Stars: ✭ 118 (-4.07%)
Mutual labels:  mail
React Share Button
📱 React share button component with web-share api and fallback modal with native intent urls
Stars: ✭ 89 (-27.64%)
Mutual labels:  mail
Spring Boot Examples
🥗​ Spring/SpringBoot/SpringCloud 实践学习案例,从入门到精通,持续更新中,欢迎交流学习🍺 !
Stars: ✭ 110 (-10.57%)
Mutual labels:  mail
Mailchain
Using Mailchain, blockchain users can now send and receive rich-media HTML messages with attachments via a blockchain address.
Stars: ✭ 74 (-39.84%)
Mutual labels:  mail
Ssh Shop
项目描述:建立购物小商城平台. 实现了前台页面系统。 技术描述:通过Spring 主框架来管理Struts2和Hibernate 框架搭建的电商小平台,用MySQL数据库并创建了表有用户表,订单表,商品表,商品分类表,商品内容表,购物车表等来存储数据。用到hibernate的懒加载方式来展示页面商品,商品分类,分类内容等信息。利用hibernate中session的方法实现分页显示商品。在网上下载的接口文档开发银行开放性接口,实现在线支付功能。用到html,css,js,ajax技术开发前端页面。后台实现利用Struts2的MVC模式对前端视图与后台数据交互,hibernate来处理dao层的业务逻辑的实现。
Stars: ✭ 78 (-36.59%)
Mutual labels:  mail
Slmmail
Send mail from Laminas or Mezzio using external mail services.
Stars: ✭ 106 (-13.82%)
Mutual labels:  mail
Go Msgauth
A Go library for DKIM, DMARC and Authentication-Results
Stars: ✭ 63 (-48.78%)
Mutual labels:  mail
Mailinabox
Mail-in-a-Box helps individuals take back control of their email by defining a one-click, easy-to-deploy SMTP+everything else server: a mail server in a box.
Stars: ✭ 10,649 (+8557.72%)
Mutual labels:  mail
Mail4delphi
Mail4Delphi uses the Indy component to send the email.
Stars: ✭ 60 (-51.22%)
Mutual labels:  mail
Mailmergelib
MailMergeLib is a mail message client library which provides comfortable mail merge capabilities for text, inline images and attachments, as well as good throughput and fault tolerance for sending mail messages.
Stars: ✭ 97 (-21.14%)
Mutual labels:  mail
Laravel Mail Editor
MailEclipse ⚡ Laravel Mailable Editor!
Stars: ✭ 1,714 (+1293.5%)
Mutual labels:  mail
Postmark Php
The official PHP library for Postmark.
Stars: ✭ 117 (-4.88%)
Mutual labels:  mail
Yii2 Swiftmailer
Yii 2 swiftmailer extension.
Stars: ✭ 109 (-11.38%)
Mutual labels:  mail

MailSender

简介

MailSender基于JavaMail for Android开发,旨在帮助开发者在Android平台快速实现邮件发送

MailSender 特点

  • Kotlin开发,兼容Java项目
  • 支持发送纯文本、html、SpannableString内容邮件发送
  • 支持发送带附件邮件
  • 支持抄送,密送

集成

repositories {
   jcenter()    
}

implementation 'com.teprinciple:mailsender:1.2.0'

使用

kotlin使用

// 创建邮箱
 val mail = Mail().apply {
    mailServerHost = "smtp.qq.com"
    mailServerPort = "587"
    fromAddress = "[email protected]"
    password = "xxxxxxxx"
    toAddress = arrayListOf("[email protected]")
    subject = "MailSender"
    content = "MailSender Android快速实现发送邮件"
    attachFiles = arrayListOf(file)
 }
 
 // 发送邮箱
 MailSender.getInstance().sendMail(mail)

Java使用

// 创建邮箱
Mail mail = new Mail();
mail.mailServerHost = "smtp.qq.com";
mail.mailServerPort = "587";
mail.fromAddress = "[email protected]";
mail.password = "xxxxxxxx";
mail.toAddress = arrayListOf("[email protected]");
mail.subject = "MailSender";
mail.content = "MailSender Android快速实现发送邮件";
mail.attachFiles = arrayListOf(file);

 // 发送邮箱
 MailSender.getInstance().sendMail(mail);

发送Html、SpannableString格式的邮件

只需将Mail类中的content,换成html或者SpannableString

// html 内容的邮件
content = 
    """
        <p1 style = "color: red">MailSender</p1><br/>
        <p1 style = "color: blue">Android快速实现发送邮件</p1><br/>
        <p1 style = "color: blue">https://github.com/teprinciple/MailSender</p1><br/>
        <p6 style = "color: gray">这是html内容的邮件</p1><br/>
        <img src="https://avatars2.githubusercontent.com/u/19629464?s=460&v=4">
    """
    
//SpannableString内容的邮件
content = SpanUtils([email protected])
    .appendLine("MailSender").setFontSize(28, true).setForegroundColor(Color.RED)
    .appendLine("Android快速实现发送邮件")
    .appendLine("https://github.com/teprinciple/MailSender").setForegroundColor(Color.BLUE)
    .appendLine("这是SpannableString内容的邮件").setForegroundColor(Color.parseColor("#efefef")).setFontSize(12, true)
    .create()    
    

Mail说明

属性 说明 是否必须
mailServerHost 发件邮箱服务器 true
mailServerPort 发件邮箱服务器端口 true
fromAddress 发件邮箱地址 true
password 发件箱授权码(密码) true
toAddress 直接收件人邮箱 true
ccAddress 抄送者邮箱 false
bccAddress 密送者邮箱 false
subject 邮件主题 false
content 邮件内容 false
attachFiles 附件 false
openSSL ssl验证开关(是否打开依据邮箱提供商配置) false
sslFactory ssl实现类 只在openSSL=true时生效 fjavax.net.ssl.SSLSocketFactory

Demo体验

关于授权码的获取

下面是qq邮箱授权码获取 怎样获取授权码?

gMail注意事项

如果一直报错 Could not connect to SMTP host: smtp.gmail.com, port: 465, response: -1 可能你的gMail认证被阻止,在google账户中,打开“允许低安全应用”开关.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].