In the general APK, we will set up a function for users to comment, the common approach is to apply for a general email, let the content sent over.
The email sent here is a third-party email sent, that is, you applied for 163, but then use QQ mailbox to log in, that is not possible, so you need to apply for authorization code, after the application, you can use the account plus authorization code to send. So, add a ZMailManager utility class here.
associated
allprojects {
repositories {
...
maven { url 'https://jitpack.io'}}}Copy the code
implementation 'com. Making. LillteZheng: ZMail: V1.0'
Copy the code
The ZMailManager code is very simple:
/ / email / * * * fromAddr - the sender email, don't fill in the wrong * nickName - the sender's nickName, don't write by defaulttest* host -- set the host service address based on the sender's email address by default. For example, [email protected], host is smtp.qq.com * isSSLvertify -- whether SSL authentication is enabled, which is enabled by default. Port 465 is enabled, and port 25 is not enabled. The * port for SSL authentication is provided by isSSLvertify, which is enabled on port 465 and disabled on port 25. Custom * subject is also supported. Do not write default This is atest*/ zmailManager.fromaddr (SEND_EMAIL).nickname (*/ zmailManager.fromaddr (SEND_EMAIL).nickname ("The fish that walks.")
.password(PASSWORD)
//.host("smtp.163.com")
//.isSSLvertify(false)
//.port(25)
.subject("Test mail")
.content("This is a test email!")
.file(imageUrl)
// .file(new String[]{imagePath})
.toAddrs(new String[]{TO_EMAIL})
.listener(this)
.send();
Copy the code
This allows you to send emails, and attachments support local and URL files, which generally suffice.
For the project, see github github.com/LillteZheng…