diff --git a/README.md b/README.md
index 98c32f14ee50d14f60d726c236cd0a9c43faa32b..31b9d9960348f9c00e3ba45c54046225382c1fe1 100644
--- a/README.md
+++ b/README.md
@@ -207,7 +207,13 @@ npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](http
prompt.showToast({message:"发送失败:" + JSON.stringify(err), duration:4000})
}
//关闭连接
- this.transport.close()
+ this.transport.close((err) => {
+ if (!err) {
+ MailLogger.info('ohos_mail-- socket close success!');
+ } else {
+ MailLogger.info('ohos_mail-- socket close fail:' + err);
+ }
+ })
})
} else {
@@ -227,6 +233,17 @@ npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](http
properties.setAuthorizationCode("")
//设置是否使用ssl
properties.ssl(true)
+
+ ------------------------------------------------------------------------------
+ //特别注意 如果是126/163/yeah 使用imap协议需要设置ID,map中的key是固定的,value任意值
+ let map = new Map()
+ map.set("name", "21cn imap");
+ map.set("version", "1.0.0");
+ map.set("vendor", "21cn");
+ map.set("support-email", "testmail@test.com");
+ store.id(map)
+ -------------------------------------------------------------------------------
+
//设置ca证书
properties.ca(this.ca)
var store = new Store(properties)
@@ -420,7 +437,7 @@ npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](http
messages[0].getContent((success, message: Message) => {
var properties = new Properties()
properties.setFrom(this.from)
- properties.setHost("smpt.qq.com")
+ properties.setHost("smtp.qq.com")
properties.setPort(25)
properties.setAuthorizationCode("asdasd")
this.transport = new TransPort()
@@ -659,11 +676,11 @@ npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](http
* 发送邮件
- `sendMessage(mimeMessage: MimeMessage, event: (success, result) => void)`
+ `sendMessage(mimeMessage: MimeMessage, event: (err) => void)`
* 关闭服务器连接
- `close()`
+ `close(event: (err) => void)`
* 发送空消息
@@ -954,7 +971,7 @@ npm环境配置等更多内容,请参考 [如何安装OpenHarmony npm包](http
| |---- MimeMessage.ts # 邮件实体
| |---- Properties.ts # 连接邮件服务器的会话信息
| |---- RecipientType.ts # 收件人类型
-| |---- ResponseCode.ts # smpt服务器响应码
+| |---- ResponseCode.ts # smtp服务器响应码
| |---- SocketUtil.ts # socket工具
| |---- Store.ts # 邮件接收、管理
| |---- TransPort.ts # 邮件发送
diff --git a/entry/src/main/ets/pages/imap.ets b/entry/src/main/ets/pages/imap.ets
index b55e6266bdf2ad962807bb052671c04599d643c8..bf02bbbc00dfc98d07ae7e4306a1c05bd0e0a4af 100644
--- a/entry/src/main/ets/pages/imap.ets
+++ b/entry/src/main/ets/pages/imap.ets
@@ -45,7 +45,7 @@ struct Imap {
private ca: string[]
aboutToAppear() {
- CAUtil.getCA(["163.root.crt", "163.crt"], (data) => {
+ CAUtil.getCA(["outlook.root.crt", "outlook.crt"], (data) => {
this.ca = data
})
}
@@ -131,6 +131,8 @@ struct Imap {
.margin({ top: 20 })
.backgroundColor('#12939f')
.onClick(async () => {
+ this.parseResult =""
+
var properties = new Properties("imap")
properties.setHost(this.hostReceive)
properties.setPort(this.portReceive)
@@ -147,7 +149,8 @@ struct Imap {
map.set("support-email", "testmail@test.com");
var store = new Store(properties)
- if (this.hostReceive.includes("126") || this.hostReceive.includes("163") || this.hostReceive.includes("189")) {
+ if (this.hostReceive.includes("126") || this.hostReceive.includes("163")
+ || this.hostReceive.includes("yeah")) {
store.id(map)
}
store.connect(async (success, err) => {
@@ -255,6 +258,7 @@ struct Imap {
let folder: Folder = store.getFolder("INBOX")
folder.open(Folder.READ_WRITE, async (err) => {
let messages = folder.getMessages()
+ MailLogger.info('ohos_mail-- open-------------------------'+messages.length)
this.msgList = ""
for (let i = 0; i < messages.length; i++) {
await new Promise((resolve, reject) => {
diff --git a/entry/src/main/ets/pages/pop.ets b/entry/src/main/ets/pages/pop.ets
index c4319fd2af6a14784532a29d6a180cc894a06aad..deb5a09b155329ca29ad655114224d8a94c3fc74 100644
--- a/entry/src/main/ets/pages/pop.ets
+++ b/entry/src/main/ets/pages/pop.ets
@@ -44,7 +44,7 @@ struct Pop {
private ca: string[]
aboutToAppear() {
- CAUtil.getCA(["189.root.crt", "189.crt"], (data) => {
+ CAUtil.getCA(["outlook.root.crt", "outlook.crt"], (data) => {
this.ca = data
})
}
@@ -130,6 +130,7 @@ struct Pop {
.margin({ top: 20 })
.backgroundColor('#12939f')
.onClick(async () => {
+ this.parseResult =""
var properties = new Properties("pop3")
properties.setHost(this.hostReceive)
properties.setPort(this.portReceive)
diff --git a/entry/src/main/ets/pages/smtp.ets b/entry/src/main/ets/pages/smtp.ets
index 37756164e7cfa44c69701d868bce86ede41676b7..f8601c35c4a83d1a69715af5bb3257fd967fdb13 100644
--- a/entry/src/main/ets/pages/smtp.ets
+++ b/entry/src/main/ets/pages/smtp.ets
@@ -56,8 +56,8 @@ struct Smtp {
private Bc: string[] = ["279562794@qq.com"];
@State private port: number = 25;
private transport: TransPort
- private subject: string = "开发计划";
- private text: string = "openharmony";
+ private subject: string = "5.1放假通知,安排";
+ private text: string = "放假五天";
private replyMsgIndex: number = 1;
private frowardMsgIndex: number = 1;
@State private portReceive: number = 143;
@@ -65,7 +65,7 @@ struct Smtp {
private ca: string[]
aboutToAppear() {
- CAUtil.getCA(["189.root.crt", "189.crt"], (data) => {
+ CAUtil.getCA(["outlook.root.crt", "outlook.crt"], (data) => {
this.ca = data
})
}
@@ -215,23 +215,23 @@ struct Smtp {
//设置html格式文件
// mimeMessage.setHtml("" + "
" + text + "
")
//设置html格式文件带图片
- let contentId = "imag01"
- mimeMessage.addImgInside(new MimeBodyPart(globalThis.filesPath, "test.png", contentId))
- let contentId1 = "imag02"
- mimeMessage.addImgInside(new MimeBodyPart(globalThis.filesPath, "test.png", contentId1))
- mimeMessage.setHtml(""
- + "" + this.text
- + "
"
- + "
"
- + "
")
+// let contentId = "imag01"
+// mimeMessage.addImgInside(new MimeBodyPart(globalThis.filesPath, "test.png", contentId))
+// let contentId1 = "imag02"
+// mimeMessage.addImgInside(new MimeBodyPart(globalThis.filesPath, "test.png", contentId1))
+// mimeMessage.setHtml(""
+// + "" + this.text
+// + "
"
+// + "
"
+// + "
")
//设置附件
- mimeMessage.addAttachmentBody(new AttachmentBody(globalThis.filesPath, "test.jpg"))
+// mimeMessage.addAttachmentBody(new AttachmentBody(globalThis.filesPath, "test.jpg"))
//发送邮件
- this.transport.sendMessage(mimeMessage, (success, err) => {
- if (success) {
+ this.transport.sendMessage(mimeMessage, (err) => {
+ if (!err) {
MailLogger.info('ohos_mail-- send mail success!');
prompt.showToast({ message: "发送成功!", duration: 2500 })
} else {
@@ -240,7 +240,13 @@ struct Smtp {
duration: 2500
})
}
- this.transport.close()
+ this.transport.close((err) => {
+ if (!err) {
+ MailLogger.info('ohos_mail-- socket close success!');
+ } else {
+ MailLogger.info('ohos_mail-- socket close fail:' + err);
+ }
+ })
})
} else {
prompt.showToast({ message: JSON.stringify(err), duration: 2500 })
@@ -372,8 +378,8 @@ struct Smtp {
}
}
//转发邮件
- this.transport.sendMessage(mimeMessage, (success, err) => {
- if (success) {
+ this.transport.sendMessage(mimeMessage, (err) => {
+ if (!err) {
MailLogger.info('ohos_mail-- send message success');
prompt.showToast({ message: "转发成功!", duration: 2500 })
} else {
@@ -382,19 +388,29 @@ struct Smtp {
duration: 2500
})
}
- store.close((success) => {
- if (success) {
- MailLogger.info('ohos_mail-- close imap success')
+
+ this.transport.close((err) => {
+ if (!err) {
+ MailLogger.info('ohos_mail-- socket close success!');
} else {
- MailLogger.info('ohos_mail-- close imap fail')
+ MailLogger.info('ohos_mail-- socket close fail:' + err);
}
})
+
})
} else {
prompt.showToast({ message: err, duration: 2500 })
MailLogger.info('ohos_mail-- login smtp fail:' + err);
}
});
+
+ store.close((success) => {
+ if (success) {
+ MailLogger.info('ohos_mail-- close imap success')
+ } else {
+ MailLogger.info('ohos_mail-- close imap fail')
+ }
+ })
})
})
} else {
@@ -524,8 +540,8 @@ struct Smtp {
}
}
//转发邮件
- this.transport.sendMessage(mimeMessage, (success, err) => {
- if (success) {
+ this.transport.sendMessage(mimeMessage, (err) => {
+ if (!err) {
MailLogger.info('ohos_mail-- send message success');
prompt.showToast({ message: "回复成功!", duration: 2500 })
} else {
@@ -534,11 +550,12 @@ struct Smtp {
duration: 2500
})
}
- store.close((success) => {
- if (success) {
- MailLogger.info('ohos_mail-- close imap success')
+
+ this.transport.close((err) => {
+ if (!err) {
+ MailLogger.info('ohos_mail-- socket close success!');
} else {
- MailLogger.info('ohos_mail-- close imap fail')
+ MailLogger.info('ohos_mail-- socket close fail:' + err);
}
})
})
@@ -547,6 +564,14 @@ struct Smtp {
MailLogger.info('ohos_mail-- login smtp fail:' + err);
}
});
+
+ store.close((success) => {
+ if (success) {
+ MailLogger.info('ohos_mail-- close imap success')
+ } else {
+ MailLogger.info('ohos_mail-- close imap fail')
+ }
+ })
})
})
} else {
diff --git a/entry/src/main/resources/rawfile/126.vip.crt b/entry/src/main/resources/rawfile/126.vip.crt
new file mode 100644
index 0000000000000000000000000000000000000000..ccac96c98516cab2c5dd261e827d6a2b35597206
--- /dev/null
+++ b/entry/src/main/resources/rawfile/126.vip.crt
@@ -0,0 +1,30 @@
+-----BEGIN CERTIFICATE-----
+MIIFDzCCA/egAwIBAgIQCxNitu5qnT6WiTDxbiB9OTANBgkqhkiG9w0BAQsFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
+QTAeFw0yMDAzMDQxMjA0NDBaFw0zMDAzMDQxMjA0NDBaMEQxCzAJBgNVBAYTAlVT
+MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxHjAcBgNVBAMTFUdlb1RydXN0IFJTQSBD
+TiBDQSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANA1OZJJtZUI
+7zj4qFHT79g+Otks4TEfmUEDhrNKBEEjb/i29GBfnpvFdT36azCg2VODJRSjIzFn
+4qADcc84EmfKiDEM97HFsQPp9RRkqx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fBwCqSpqsNckKT7KKtf3Ot95wYFpKDa64jcRUfxzRWnmq12IVzczqHI
+sIvUZQINw/UHSQcWekdUnMg58bQSHyTjwkj9jcX2RURxaVZkr15wxo/Z3Ydo2PVK
+3afEr0/vcuFvE7QeGXiI2DJdVt3JefatZ3rj4VTW2aUZwHGUiWWIUudBfQKR0JEp
+lJ8MFaKDh4/A2VEJnXILu1iwvc1m3jCaPuzZKdoHM/1234bznJI2aAfhfIhoHw90
+tPO+
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/entry/src/main/resources/rawfile/126.vip.root.crt b/entry/src/main/resources/rawfile/126.vip.root.crt
new file mode 100644
index 0000000000000000000000000000000000000000..8f3aea9d584507ac69436d2985eabb559995d40c
--- /dev/null
+++ b/entry/src/main/resources/rawfile/126.vip.root.crt
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
+QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
+MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
+b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
+9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
+CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
+nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
+43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
+T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
+gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
+BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
+TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
+DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
+hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
+06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
+PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
+YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
+CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/entry/src/main/resources/rawfile/aliyun.crt b/entry/src/main/resources/rawfile/aliyun.crt
new file mode 100644
index 0000000000000000000000000000000000000000..619b81c0e04f487f5d4570492814fb7ef7700477
--- /dev/null
+++ b/entry/src/main/resources/rawfile/aliyun.crt
@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIETjCCAzagAwIBAgINAe5fIh38YjvUMzqFVzANBgkqhkiG9w0BAQsFADBMMSAw
+HgYDVQQLExdHbG9iYWxTaWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFs
+U2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln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XoFYC20UgDX1b10d65pHBf9ZjQCxQNqQmJYaumxtf4z1s4DfjGRzNpZ5eWl0
+6r/4ngGPoJVpjemEuunl1Ig423g7mNA2eymw0lIYkN5SQwCuaifIFJ6GlazhgDEw
+fpolu4usBCOmmQDo8dIm7A9+O4orkjgTHY+GzYZSR+Y0fFukAj6KYXwidlNalFMz
+hriSqHKvoflShx8xpfywgVcvzfTO3PYkz6fiNJBonf6q8amaEsybwMbDqKWwIX7e
+SPY=
+-----END CERTIFICATE-----
diff --git a/entry/src/main/resources/rawfile/aliyun.root.crt b/entry/src/main/resources/rawfile/aliyun.root.crt
new file mode 100644
index 0000000000000000000000000000000000000000..c44534c66c38d8d2d094eac45a446c7bd9daac02
--- /dev/null
+++ b/entry/src/main/resources/rawfile/aliyun.root.crt
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
+A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
+b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
+MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
+YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
+aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
+jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
+xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
+1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
+snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
+U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
+9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
+BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
+AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
+yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
+38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
+AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
+DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
+HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/entry/src/main/resources/rawfile/foxmail.crt b/entry/src/main/resources/rawfile/foxmail.crt
new file mode 100644
index 0000000000000000000000000000000000000000..dbb6b24dc64f368ca73674493abe016b6403e4a8
--- /dev/null
+++ b/entry/src/main/resources/rawfile/foxmail.crt
@@ -0,0 +1,26 @@
+-----BEGIN CERTIFICATE-----
+MIIEaTCCA1GgAwIBAgILBAAAAAABRE7wQkcwDQYJKoZIhvcNAQELBQAwVzELMAkG
+A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
+b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw0xNDAyMjAxMDAw
+MDBaFw0yNDAyMjAxMDAwMDBaMGYxCzAJBgN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muo2wCId2Dkyy2VG7EQLy
+XN0cvfNVlg/UBsD84iOKJHDTu/B5GqdhcIOKrwbFINihY9Bsrk8y1658GEV1BSl3
+30JAZGSGvip2CTFvHST0mdCF/vIhCPnG9vHQWe3WVjwIKANnuvD58ZAWR65n5ryA
+SOlCdjSXVWkkDoPWoC209fN5ikkodBpBocLTJIg1MGCUF7ThBCIxPTsvFwayuJ2G
+K1pp74P1S8SqtCr4fKGxhZSM9AyHDPSsQPhZSZg=
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/entry/src/main/resources/rawfile/foxmail.root.crt b/entry/src/main/resources/rawfile/foxmail.root.crt
new file mode 100644
index 0000000000000000000000000000000000000000..c44534c66c38d8d2d094eac45a446c7bd9daac02
--- /dev/null
+++ b/entry/src/main/resources/rawfile/foxmail.root.crt
@@ -0,0 +1,21 @@
+-----BEGIN CERTIFICATE-----
+MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkG
+A1UEBhMCQkUxGTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jv
+b3QgQ0ExGzAZBgNVBAMTEkdsb2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAw
+MDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNVBAYTAkJFMRkwFwYDVQQKExBHbG9i
+YWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYDVQQDExJHbG9iYWxT
+aWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDaDuaZ
+jc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavp
+xy0Sy6scTHAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp
+1Wrjsok6Vjk4bwY8iGlbKk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdG
+snUOhugZitVtbNV4FpWi6cgKOOvyJBNPc1STE4U6G7weNLWLBYy5d4ux2x8gkasJ
+U26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrXgzT/LCrBbBlDSgeF59N8
+9iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8E
+BTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0B
+AQUFAAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOz
+yj1hTdNGCbM+w6DjY1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE
+38NflNUVyRRBnMRddWQVDf9VMOyGj/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymP
+AbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhHhm4qxFYxldBniYUr+WymXUad
+DKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveCX4XSQRjbgbME
+HMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/entry/src/main/resources/rawfile/outlook.crt b/entry/src/main/resources/rawfile/outlook.crt
new file mode 100644
index 0000000000000000000000000000000000000000..230802b622327d636f759becbcded6ba98e22fa0
--- /dev/null
+++ b/entry/src/main/resources/rawfile/outlook.crt
@@ -0,0 +1,29 @@
+-----BEGIN CERTIFICATE-----
+MIIE6DCCA9CgAwIBAgIQAnQuqhfKjiHHF7sf/P0MoDANBgkqhkiG9w0BAQsFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
+QTAeFw0yMDA5MjMwMDAwMDBaFw0zMDA5MjI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EKTAnMAcGBWeBDAEBMAgGBmeB
+DAECATAIBgZngQwBAgIwCAYGZ4EMAQIDMA0GCSqGSIb3DQEBCwUAA4IBAQB3MR8I
+l9cSm2PSEWUIpvZlubj6kgPLoX7hyA2MPrQbkb4CCF6fWXF7Ef3gwOOPWdegUqHQ
+S1TSSJZI73fpKQbLQxCgLzwWji3+HlU87MOY7hgNI+gH9bMtxKtXc1r2G1O6+x/6
+vYzTUVEgR17vf5irF0LKhVyfIjc0RXbyQ14AniKDrN+v0ebHExfppGlkTIBn6rak
+f4994VH6npdn6mkus5CkHBXIrMtPKex6XF2firjUDLuU7tC8y7WlHgjPxEEDDb0G
+w6D0yDdVSvG/5XlCNatBmO/8EznDu1vr72N8gJzISUZwa6CCUD7QBLbKJcXBBVVf
+8nwvV9GvlW+sbXlr
+-----END CERTIFICATE-----
diff --git a/entry/src/main/resources/rawfile/sina.root.crt b/entry/src/main/resources/rawfile/outlook.root.crt
similarity index 100%
rename from entry/src/main/resources/rawfile/sina.root.crt
rename to entry/src/main/resources/rawfile/outlook.root.crt
diff --git a/entry/src/main/resources/rawfile/sina.crt b/entry/src/main/resources/rawfile/sina.cn.crt
similarity index 100%
rename from entry/src/main/resources/rawfile/sina.crt
rename to entry/src/main/resources/rawfile/sina.cn.crt
diff --git a/entry/src/main/resources/rawfile/sina.cn.root.crt b/entry/src/main/resources/rawfile/sina.cn.root.crt
new file mode 100644
index 0000000000000000000000000000000000000000..fd4341df26631d749ae1bd891e5b8780dac8c8bf
--- /dev/null
+++ b/entry/src/main/resources/rawfile/sina.cn.root.crt
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWw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29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
+-----END CERTIFICATE-----
diff --git a/entry/src/main/resources/rawfile/sina.com.crt b/entry/src/main/resources/rawfile/sina.com.crt
new file mode 100644
index 0000000000000000000000000000000000000000..a4f77b74a9f86b0661b975eb0bea1bed99e0a84e
--- /dev/null
+++ b/entry/src/main/resources/rawfile/sina.com.crt
@@ -0,0 +1,30 @@
+-----BEGIN CERTIFICATE-----
+MIIFGjCCBAKgAwIBAgIQCgRw0Ja8ihLIkKbfgm7sSzANBgkqhkiG9w0BAQsFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
+QTAeFw0xOTA2MjAxMjI3NThaFw0yOTA2MjAxMjI3NThaMF8xCzAJBgNVBAYTAlVT
+MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
+b20xHjAcBgNVBAMTFUdlb1RydXN0IENOIFJTQSBDQSBHMTCCASIwDQYJKoZIhvcN
+AQEBBQADggEPADCCAQoCggEBALFJ+j1KeZVG4jzgQob23lQ8PJUNhY31ufZihuUx
+hYc6HSU4Lw0fxfA43a9DpJl74M3E6F1ZRBOfJ+dWnaiyYD0PxRIQd4wJisti4Uad
+vz61IYY/oQ/Elxk/X7GFDquYuxCSyBdHtTVMXCxFSvQ2C/7jWZFDfGGKKNoQSiJy
+wDe8iiHbUOakLMmXmOTZyWJnFdR/TH5YNTiMKCNUPHAleG4IigGxDyL/gbwrdDNi
+bDA4lUNhD0xNvPjQ8BNKqm5HWDvirUuHdC+4hpi0GJO34O3iiRV16YmWTuVFNboU
+LDZ0+PQtctJnatpuZKPGyKX6jCpPvzzPw/EhNDlpEdrYHZMCAwEAAaOCAc4wggHK
+MB0GA1UdDgQWBBSRn14xFa4Qn61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.com.root.crt
new file mode 100644
index 0000000000000000000000000000000000000000..fd4341df26631d749ae1bd891e5b8780dac8c8bf
--- /dev/null
+++ b/entry/src/main/resources/rawfile/sina.com.root.crt
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
+QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
+MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
+b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
+9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
+CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
+nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
+43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
+T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
+gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
+BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
+TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
+DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
+hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
+06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
+PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
+YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
+CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
+-----END CERTIFICATE-----
diff --git a/entry/src/main/resources/rawfile/wo.crt b/entry/src/main/resources/rawfile/wo.crt
new file mode 100644
index 0000000000000000000000000000000000000000..ba9b456119b0a5f56dadb21c3fac321ad9301a7a
--- /dev/null
+++ b/entry/src/main/resources/rawfile/wo.crt
@@ -0,0 +1,30 @@
+-----BEGIN CERTIFICATE-----
+MIIFFTCCA/2gAwIBAgIQAvfh+YK60Amv9H3JV0Gy9jANBgkqhkiG9w0BAQsFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
+QTAeFw0yMDAzMDQxMjA0MDdaFw0zMDAzMDQxMjA0MDdaMEoxCzAJBgNVBAYTAlVT
+MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxJDAiBgNVBAMTG0RpZ2lDZXJ0IEJhc2lj
+IFJTQSBDTiBDQSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL49
+9vplPYX4qjNjUI5QT6Ugcc8RjkWJFdcC2hMwvPbNQ6RLbjmvEBGHinnDlpBwb8FZ
+kBGWVv+Djnfe9825hBwEH2iaI0D6QpjEd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eUf9o0gcIN1h5SWDooMXGjdS42MUosuAsTH2reeBuNL4U
+MDJoTw5mIwTRG2Qi3z74VVTJvXRPJYJL+SrY9HdRH382YEAXK5go4aRMaqvXY/Ob
+TfGIL0tKLy1Mg5oaWa1SlNTgmar+gEsSGLuB8LY1yR7vIpLMCbJEF83TnCcqw8hA
+NRJiGhVFyRB75UDuSHQi5rveZupfzfAf6OayAEk5NjemjOuD5AgeXvnyl83rPOJ3
+wAx1cXMDxcLU
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/entry/src/main/resources/rawfile/wo.root.crt b/entry/src/main/resources/rawfile/wo.root.crt
new file mode 100644
index 0000000000000000000000000000000000000000..8f3aea9d584507ac69436d2985eabb559995d40c
--- /dev/null
+++ b/entry/src/main/resources/rawfile/wo.root.crt
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
+QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
+MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j
+b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG
+9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB
+CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97
+nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt
+43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P
+T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4
+gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO
+BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR
+TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw
+DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr
+hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg
+06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF
+PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls
+YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
+CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
+-----END CERTIFICATE-----
\ No newline at end of file
diff --git a/entry/src/main/resources/rawfile/yeah.crt b/entry/src/main/resources/rawfile/yeah.crt
new file mode 100644
index 0000000000000000000000000000000000000000..a4f77b74a9f86b0661b975eb0bea1bed99e0a84e
--- /dev/null
+++ b/entry/src/main/resources/rawfile/yeah.crt
@@ -0,0 +1,30 @@
+-----BEGIN CERTIFICATE-----
+MIIFGjCCBAKgAwIBAgIQCgRw0Ja8ihLIkKbfgm7sSzANBgkqhkiG9w0BAQsFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQ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S9DUFMwgYoGCCsGAQUFBwICMH4MfEFu
+eSB1c2Ugb2YgdGhpcyBDZXJ0aWZpY2F0ZSBjb25zdGl0dXRlcyBhY2NlcHRhbmNl
+IG9mIHRoZSBSZWx5aW5nIFBhcnR5IEFncmVlbWVudCBsb2NhdGVkIGF0IGh0dHBz
+Oi8vd3d3LmRpZ2ljZXJ0LmNvbS9ycGEtdWEwDQYJKoZIhvcNAQELBQADggEBABfg
+eXrxIrtlixBv+KMDeqKxtNJbZiLDzJBkGCd4HI63X5eS6BElJBn6mI9eYVrr7qOL
+Tp7WiO02Sf1Yrpaz/ePSjZ684o89UAGpxOfbgVSMvo/a07n/220jUWLxzaJhQNLu
+lACXwwWsxYf8twP8glkoIHnUUNTlhsyyl1ZzvVC4bDpI4hC6QkJGync1MNqYSMj8
+tZbhQNw3HdSmcTO0Nc/J/pK2VZc6fFbKBgspmzdHc6jMKG2t4lisXEysS3wPcg0a
+Nfr1Odl5+myh3MnMK08f6pTXvduLz+QZiIh8IYL+Z6QWgTZ9e2jnV8juumX1I8Ge
+7cZdtNnTCB8hFfwGLUA=
+-----END CERTIFICATE-----
diff --git a/entry/src/main/resources/rawfile/yeah.root.crt b/entry/src/main/resources/rawfile/yeah.root.crt
new file mode 100644
index 0000000000000000000000000000000000000000..fd4341df26631d749ae1bd891e5b8780dac8c8bf
--- /dev/null
+++ b/entry/src/main/resources/rawfile/yeah.root.crt
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh
+MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
+d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD
+QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT
+MRUwEwYDV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main/ets/Util.ts
index d662bfb142c73b190d6994f198fba52a58222200..1c1ddb7668fd61a0ca9e9fe1e78491755e3560a1 100644
--- a/mail/src/main/ets/Util.ts
+++ b/mail/src/main/ets/Util.ts
@@ -372,41 +372,61 @@ export class Util {
}
let str = responseStr.split(Constant.LINEFEED)
let info = new Map()
- if (!!str && str.length >= 5) {
- info.set(Constant.MESSAGE_COUNT, Number(str[0].split(" ")[1]))
- info.set(Constant.NEW_MESSAGE_COUNT, Number(str[1].split(" ")[1]))
- //获取未读邮件个数
- let uidNext
- let uidValidity
- if (str[2].includes("UNSEEN")) {
- let strStartIndex = str[2].indexOf("[");
- let strEndIndex = str[2].indexOf("]");
- if (strStartIndex >= 0 || strEndIndex >= 0) {
- let result = str[2].substring(strStartIndex, strEndIndex).substring(1);
- info.set(Constant.UNREAD_MESSAGE_COUNT, Number(result.split(" ")[1]))
+ if (!!str){
+ for (let i = 0; i < str.length; i++) {
+ if (str[i].includes("EXISTS")) {
+ let msgCountArr = str[i].split(" ")
+ if (msgCountArr.length > 1) {
+ info.set(Constant.MESSAGE_COUNT, Number(msgCountArr[1]))
+ }
+ continue
}
- uidNext = str[4]
- uidValidity = str[3]
- } else {
- uidNext = str[3]
- uidValidity = str[2]
- info.set(Constant.UNREAD_MESSAGE_COUNT, 0)
- }
- if (uidNext.includes(Constant.UID_NEXT)) {
- let startIndex = uidNext.indexOf("[");
- let endIndex = uidNext.indexOf("]");
- if (startIndex >= 0 || endIndex >= 0) {
- let result = uidNext.substring(startIndex, endIndex).substring(1);
- info.set(Constant.UID_NEXT, Number(result.split(" ")[1]))
+
+ if (str[i].includes("RECENT")) {
+ let newMsgCountArr = str[i].split(" ")
+ if (newMsgCountArr.length > 1) {
+ info.set(Constant.NEW_MESSAGE_COUNT, Number(newMsgCountArr[1]))
+ }
+ continue
+ }
+
+ if (str[i].includes("UNSEEN")) {
+ let strStartIndex = str[i].indexOf("[");
+ let strEndIndex = str[i].indexOf("]");
+ if (strStartIndex >= 0 || strEndIndex >= 0) {
+ let result = str[i].substring(strStartIndex, strEndIndex).substring(1);
+ let unReadMsgCountArr = result.split(" ")
+ if (unReadMsgCountArr.length > 1) {
+ info.set(Constant.UNREAD_MESSAGE_COUNT, Number(unReadMsgCountArr[1]))
+ }
+ }
+ continue
+ }
+
+ if (str[i].includes("UIDVALIDITY")) {
+ let startIndex = str[i].indexOf("[");
+ let endIndex = str[i].indexOf("]");
+ if (startIndex >= 0 || endIndex >= 0) {
+ let result = str[i].substring(startIndex, endIndex).substring(1);
+ let uidValidityArr = result.split(" ")
+ if (uidValidityArr.length > 1) {
+ info.set(Constant.UID_VALIDITY, Number(uidValidityArr[1]))
+ }
+ }
+ continue
}
- }
- if (uidValidity.includes(Constant.UID_VALIDITY)) {
- let startIndex = uidValidity.indexOf("[");
- let endIndex = uidValidity.indexOf("]");
- if (startIndex >= 0 || endIndex >= 0) {
- let result = uidValidity.substring(startIndex, endIndex).substring(1);
- info.set(Constant.UID_VALIDITY, Number(result.split(" ")[1]))
+ if (str[i].includes("UIDNEXT")) {
+ let startIndex = str[i].indexOf("[");
+ let endIndex = str[i].indexOf("]");
+ if (startIndex >= 0 || endIndex >= 0) {
+ let result = str[i].substring(startIndex, endIndex).substring(1);
+ let uidNextArr = result.split(" ")
+ if (uidNextArr.length > 1) {
+ info.set(Constant.UID_NEXT, Number(uidNextArr[1]))
+ }
+ }
+ continue
}
}
}
diff --git a/mail/src/main/ets/mail/MimeMessage.ts b/mail/src/main/ets/mail/MimeMessage.ts
index 826262c61f109764662ee94cb23983a0621e1e74..17d377376cb24da311df9b7b34d6de8f42cc05ca 100644
--- a/mail/src/main/ets/mail/MimeMessage.ts
+++ b/mail/src/main/ets/mail/MimeMessage.ts
@@ -358,7 +358,7 @@ export class MimeMessage {
recipient = "To: "
for (let i = 0; i < this.to.length; i++) {
if (i != this.to.length - 1) {
- recipient += "<" + this.to[i] + ">,"
+ recipient += "<" + this.to[i] + ">, "
} else {
recipient += "<" + this.to[i] + ">" + Constant.LINEFEED
}
@@ -371,7 +371,7 @@ export class MimeMessage {
recipient = "Cc: "
for (let i = 0; i < this.Cc.length; i++) {
if (i != this.Cc.length - 1) {
- recipient += "<" + this.Cc[i] + ">,"
+ recipient += "<" + this.Cc[i] + ">, "
} else {
recipient += "<" + this.Cc[i] + ">" + Constant.LINEFEED
}
@@ -384,7 +384,7 @@ export class MimeMessage {
recipient = "BC: "
for (let i = 0; i < this.Bc.length; i++) {
if (i != this.Bc.length - 1) {
- recipient += "<" + this.Bc[i] + ">,"
+ recipient += "<" + this.Bc[i] + ">, "
} else {
recipient += "<" + this.Bc[i] + ">" + Constant.LINEFEED
}
diff --git a/mail/src/main/ets/mail/Store.ts b/mail/src/main/ets/mail/Store.ts
index c17e42950a99596a0e8fa7f68489f96a35ff1d56..7c7aeac6fa3e1e046b6696c7547f24849407bf58 100644
--- a/mail/src/main/ets/mail/Store.ts
+++ b/mail/src/main/ets/mail/Store.ts
@@ -93,7 +93,7 @@ export class Store {
}, (value) => {
//服务端响应监听
MailLogger.info("ohos_mail-- response*************************************")
- var asciiToStr = ''
+ let asciiToStr = ''
let decodeNum = new Uint8Array(value.message)
asciiToStr = String.fromCharCode.apply(null, decodeNum);
let lines = asciiToStr.split(Constant.LINEFEED)
@@ -119,6 +119,7 @@ export class Store {
}
} else {
lastLine = lines.length > 1 ? lines[lines.length-2] : lines[lines.length-1]
+ MailLogger.info('ohos_mail-- lastLine**************' + lastLine)
}
if (this.properties.getProtocol() == "pop3") {
@@ -256,7 +257,7 @@ export class Store {
if (lastLine.startsWith("A03")) {
this.isStartWrite = false
if (lastLine.startsWith("A03 OK")) {
- let info = Util.getInboxInfo(this.responseDecode)
+ let info = Util.getInboxInfo(asciiToStr)
this.folder.setFolderInfo(info)
this.infoEvent(null)
} else {
@@ -414,7 +415,7 @@ export class Store {
}
socket.send(cmd).then(() => {
- MailLogger.info('ohos_mail send login success');
+ MailLogger.info('ohos_mail send login success'+JSON.stringify(cmd));
}).catch(err => {
MailLogger.error('ohos_mail send login fail :' + JSON.stringify(err));
})
diff --git a/mail/src/main/ets/mail/TransPort.ts b/mail/src/main/ets/mail/TransPort.ts
index 78df66d3ba452c4a201dc5aa9de919a9ae63e4c3..a03cc08e505d6c6dc34939e44c14c36fc7561bcf 100644
--- a/mail/src/main/ets/mail/TransPort.ts
+++ b/mail/src/main/ets/mail/TransPort.ts
@@ -18,7 +18,6 @@ import { Constant } from '../Constant';
import { Properties } from '../mail/Properties'
import { Util } from '../Util'
import { MailLogger } from '../MailLogger';
-import { ResponseCode } from '../mail/ResponseCode';
import { SocketUtil } from './SocketUtil';
var socket
@@ -30,10 +29,13 @@ export class TransPort {
private properties: Properties
private timeout: number = 6000
private host: string
- private sendMessageEvent: Function
- private authenticationEvent: Function
- private sendDataBodyEvent: Function
+ private sendMessageEvent: (err?: string) => void
+ private authenticationEvent: (err?: string) => void
+ private closeEvent: (err?: string) => void
private isSSL: boolean = false
+ private expectCode = "220"
+ private serverIsReady = false
+ private isConnect = false
/**
* 设置连接服务器超时时长
@@ -73,80 +75,49 @@ export class TransPort {
loginEvent(false, err)
}
}, (value) => {
- var asciiToStr = ''
+ let asciiToStr = ""
let decodeNum = new Uint8Array(value.message)
asciiToStr = String.fromCharCode.apply(null, decodeNum);
MailLogger.info("ohos_mail-- server response :" + asciiToStr)
//服务器响应220 表示服务器就绪
- if (asciiToStr.startsWith(ResponseCode.SERVICE_READY)) {
+ if (!this.serverIsReady && asciiToStr.startsWith(this.expectCode)) {
+ this.serverIsReady = true
this.login()
return
- }
-
- //和服务器握手响应
- if (asciiToStr.startsWith(ResponseCode.MAIL_OPERATE_COMPLETE + "-")) {
- this.authenticationEvent()
- return
- }
-
- //等待用户发送用户名
- if (asciiToStr.startsWith(ResponseCode.WAIT_USER_SEND_AUTH_INFO_USERNAME)) {
- this.authenticationEvent()
- return
- }
-
- //等待用户发送授权码
- if (asciiToStr.startsWith(ResponseCode.WAIT_USER_SEND_AUTH_INFO_PASSWORD)) {
- this.authenticationEvent()
- return
- }
-
- //服务器响应235 表示鉴权成功
- if (asciiToStr.startsWith(ResponseCode.AUTHENTICATION_SUCCESS)) {
- loginEvent(true, '')
- return
- }
-
- //服务器响应535 表示鉴权失败
- if (asciiToStr.startsWith(ResponseCode.AUTHENTICATION_FAIL)) {
- loginEvent(false, asciiToStr)
- return
- }
-
- if (asciiToStr.startsWith(ResponseCode.ABANDON_OPERATE)) {
- loginEvent(false, asciiToStr)
- return
- }
-
- //服务器响应354 表示服务器等待发送邮件内容
- if (asciiToStr.startsWith(ResponseCode.WAIT_USER_SEND_MESSAGE_BODY)) {
- this.authenticationEvent()
- return
- }
-
- //服务器响应503/502 表示错误的命令
- if (asciiToStr.startsWith(ResponseCode.COMMAND_ERR) || asciiToStr.startsWith(ResponseCode.ERROR_COMMAND_SEQUENCE)) {
- this.sendMessageEvent(false, asciiToStr)
- return
- }
+ } else if (asciiToStr.startsWith(this.expectCode)) {
+ if (this.expectCode.startsWith("221")) {
+ socket.off('message');
+ this.closeEvent()
+ this.serverIsReady = false
+ this.isConnect = false
+ if (!!socket) {
+ socket.close(err => {
+ if (err) {
+ MailLogger.error('ohos_mail socket close fail ' + JSON.stringify(err));
+ return;
+ }
+ MailLogger.info('ohos_mail socket close success');
+ })
+ }
+ return
+ }
- if (!!this.sendDataBodyEvent && asciiToStr.startsWith("250")) {
- this.sendDataBodyEvent(true, "")
- return
- }
-
- //服务器响应250 发送邮件成功
- if (asciiToStr.startsWith("250") && asciiToStr.includes("queue")) {
- this.sendDataBodyEvent(true, "")
- return
- }
-
- //邮件操作完成
- if (asciiToStr.startsWith(ResponseCode.MAIL_OPERATE_COMPLETE)) {
this.authenticationEvent()
- return
+ if (this.expectCode.startsWith("235")) { //鉴权完成
+ this.isConnect = true
+ loginEvent(true, '')
+ }
+ } else {
+ this.authenticationEvent(asciiToStr)
+ if (this.isConnect) {
+ this.sendMessageEvent(asciiToStr)
+ } else {
+ loginEvent(false, asciiToStr)
+ }
+ this.serverIsReady = false
+ this.isConnect = false
}
- loginEvent(false, asciiToStr)
+ asciiToStr = ""
})
}
@@ -155,27 +126,39 @@ export class TransPort {
*/
private async login() {
await new Promise((resolve, reject) => {
- this.sendEHLO(() => {
- resolve("")
- })
+ this.sendEHLO((err) => {
+ if (!err) {
+ resolve("")
+ return
+ }
+ }, "250")
}).then((result) => {
return new Promise((resolve, reject) => {
- this.sendAuthLogin(() => {
- resolve("")
- })
+ this.sendAuthLogin((err) => {
+ if (!err) {
+ resolve("")
+ return
+ }
+ }, "334")
})
}).then((result) => {
return new Promise((resolve, reject) => {
- this.sendUser(() => {
- resolve("")
- })
+ this.sendUser((err) => {
+ if (!err) {
+ resolve("")
+ return
+ }
+ }, "334")
})
}).then((result) => {
return new Promise((resolve, reject) => {
- this.sendPassword(() => {
- resolve("")
- })
+ this.sendPassword((err) => {
+ if (!err) {
+ resolve("")
+ return
+ }
+ }, "235")
})
})
}
@@ -184,7 +167,7 @@ export class TransPort {
* 向服务器打招呼
* @param event
*/
- private sendEHLO(event: () => void) {
+ private sendEHLO(event: (err?) => void, expectCode) {
this.authenticationEvent = event
let cmd = this.isSSL ? "EHLO " + this.host + Constant.LINEFEED :
@@ -192,6 +175,7 @@ export class TransPort {
encoding: "UTF-8" }
socket.send(cmd).then(() => {
+ this.expectCode = expectCode
MailLogger.info('ohos_mail-- send EHLO success ');
}).catch(err => {
MailLogger.error('ohos_mail-- send EHLO fail ' + JSON.stringify(err));
@@ -202,7 +186,7 @@ export class TransPort {
*
* 发送登陆鉴权请求
*/
- private sendAuthLogin(event: () => void) {
+ private sendAuthLogin(event: (err?) => void, expectCode) {
this.authenticationEvent = event
let cmd = this.isSSL ? "AUTH LOGIN" + Constant.LINEFEED :
@@ -210,6 +194,7 @@ export class TransPort {
encoding: "UTF-8" }
socket.send(cmd).then(() => {
+ this.expectCode = expectCode
MailLogger.info('ohos_mail-- send AUTH LOGIN success');
}).catch(err => {
MailLogger.error('ohos_mail-- send AUTH LOGIN fail ' + JSON.stringify(err));
@@ -219,7 +204,7 @@ export class TransPort {
/**
* 发送用户名
*/
- private sendUser(event: () => void) {
+ private sendUser(event: (err?) => void, expectCode) {
this.authenticationEvent = event
let user = Util.encodeString(this.properties.getFrom()) + Constant.LINEFEED
@@ -228,6 +213,7 @@ export class TransPort {
encoding: "UTF-8" }
socket.send(cmd).then(() => {
+ this.expectCode = expectCode
MailLogger.info('ohos_mail-- send user success');
}).catch(err => {
MailLogger.error('ohos_mail-- send fail ' + JSON.stringify(err));
@@ -237,7 +223,7 @@ export class TransPort {
/**
* 发送授权码
*/
- private sendPassword(event: () => void) {
+ private sendPassword(event: (err?) => void, expectCode) {
this.authenticationEvent = event
let pass = Util.encodeString(this.properties.getAuthorizationCode()) + Constant.LINEFEED
@@ -246,7 +232,8 @@ export class TransPort {
encoding: "UTF-8" }
socket.send(cmd).then(() => {
- MailLogger.info('ohos_mail-- send AuthorizationCode success');
+ this.expectCode = expectCode
+ MailLogger.info('ohos_mail-- send pass success');
}).catch(err => {
MailLogger.error('ohos_mail-- send fail ' + JSON.stringify(err));
})
@@ -257,35 +244,43 @@ export class TransPort {
* @param mimeMessage
* @param callback
*/
- public async sendMessage(mimeMessage: MimeMessage, event: (success, result) => void) {
+ public async sendMessage(mimeMessage: MimeMessage, event: (err) => void) {
this.sendMessageEvent = event
await new Promise((resolve, reject) => {
- this.sendFrom(mimeMessage, () => {
- resolve("")
- })
+ this.sendFrom(mimeMessage, (err) => {
+ if (!err) {
+ resolve("")
+ }
+ }, "250")
}).then((result) => {
return new Promise((resolve, reject) => {
- this.sendRCPT(mimeMessage, () => {
- resolve("")
+ this.sendRCPTs(mimeMessage, (err) => {
+ if (!err) {
+ resolve("")
+ }
})
})
}).then((result) => {
return new Promise((resolve, reject) => {
- this.sendDATA(() => {
- resolve("")
- })
+ this.sendDATA((err) => {
+ if (!err) {
+ resolve("")
+ }
+ }, "354")
})
}).then((result) => {
return new Promise((resolve, reject) => {
- this.sendMsgData(mimeMessage, (success, err) => {
- this.sendMessageEvent(success, err)
- resolve('')
- })
+ this.sendMsgData(mimeMessage, (err) => {
+ if (!err) {
+ this.sendMessageEvent()
+ resolve("")
+ }
+ }, "250")
})
})
}
- private sendFrom(mimeMessage: MimeMessage, event: () => void) {
+ private sendFrom(mimeMessage: MimeMessage, event: (err?) => void, expectCode) {
this.authenticationEvent = event
let cmd = this.isSSL ? "MAIL FROM: <" + mimeMessage.getFrom() + ">" + Constant.LINEFEED :
@@ -293,27 +288,43 @@ export class TransPort {
encoding: "UTF-8" }
socket.send(cmd).then(() => {
- MailLogger.info('ohos_mail-- send MAIL FROM success to:');
+ this.expectCode = expectCode
+ MailLogger.info('ohos_mail-- send MAIL FROM success');
}).catch(err => {
MailLogger.error('ohos_mail-- send fail ' + JSON.stringify(err));
})
}
- private sendRCPT(mimeMessage: MimeMessage, event: () => void) {
+ private async sendRCPTs(mimeMessage: MimeMessage, event: (success) => void) {
+ let recipients = mimeMessage.getAllRecipients()
+ for (let i = 0; i < recipients.length; i++) {
+ await new Promise((resolve, reject) => {
+ this.sendRCPT(recipients[i], (err) => {
+ if (!err) {
+ resolve("")
+ }
+ }, "250")
+ })
+ }
+ event(null)
+ }
+
+
+ private sendRCPT(address, event: (err?) => void, expectCode) {
this.authenticationEvent = event
- let recipients = mimeMessage.getAllRecipient()
- let cmd = this.isSSL ? recipients :
- { data: recipients,
+ let cmd = this.isSSL ? "RCPT TO:<" + address + ">" + Constant.LINEFEED :
+ { data: "RCPT TO:<" + address + ">" + Constant.LINEFEED,
encoding: "UTF-8" }
socket.send(cmd).then(() => {
- MailLogger.info('ohos_mail-- send RCPT success to:');
+ this.expectCode = expectCode
+ MailLogger.info('ohos_mail-- send RCPT success');
}).catch(err => {
MailLogger.error('ohos_mail-- send RCPT fail: ' + JSON.stringify(err));
})
}
- private sendDATA(dataEvent: () => void) {
+ private sendDATA(dataEvent: (err?) => void, expectCode) {
this.authenticationEvent = dataEvent
let cmd = this.isSSL ? "DATA" + Constant.LINEFEED :
@@ -321,6 +332,7 @@ export class TransPort {
encoding: "UTF-8" }
socket.send(cmd).then(() => {
+ this.expectCode = expectCode
MailLogger.info('ohos_mail-- send DATA success');
}).catch(err => {
MailLogger.error('ohos_mail-- send DATA fail: ' + JSON.stringify(err));
@@ -330,37 +342,38 @@ export class TransPort {
/**
* 发送邮件内容
*/
- private sendMsgData(mimeMessage: MimeMessage, event: (success, err) => void) {
- this.sendDataBodyEvent = event
+ private sendMsgData(mimeMessage: MimeMessage, event: (err?) => void, expectCode) {
+ this.authenticationEvent = event
let message = mimeMessage.getMimeMessage()
+
let cmd = this.isSSL ? String.fromCharCode.apply(null, new Uint8Array(message)) :
{ data: message,
encoding: "UTF-8" }
socket.send(cmd).then(() => {
+ this.expectCode = expectCode
MailLogger.info('ohos_mail-- send msg body success');
}).catch(err => {
MailLogger.error('ohos_mail-- send msg body fail: ' + JSON.stringify(err));
- this.sendDataBodyEvent(false, err)
+ this.authenticationEvent(err)
})
}
/**
* 退出当前登录
*/
- public close() {
+ public close(event: (err) => void) {
+ this.closeEvent = event
let cmd = this.isSSL ? "QUIT" + Constant.LINEFEED :
{ data: "QUIT" + Constant.LINEFEED,
encoding: "UTF-8" }
socket.send(cmd).then(() => {
+ this.expectCode = "221"
MailLogger.info('ohos_mail-- send quit success');
}).catch(err => {
MailLogger.error('ohos_mail-- send quit fail ' + JSON.stringify(err));
})
- if (!!socket) {
- socket.close()
- }
}
/**
diff --git a/testFile/pushFile.bat b/testFile/pushFile.bat
index d4f4440fc3a82949e99422ff47e0ff862c7ac847..1ac5982a5ba2e4e27758abd9bb3d7ac55c98b489 100644
--- a/testFile/pushFile.bat
+++ b/testFile/pushFile.bat
@@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
-oid sha256:6ba07503f45a23af5062a8212a581ed7e0360317f8ec6a1666879a8839b47285
+oid sha256:4c1e1d38d01512e51a8f8adb7c18980742c5b43bc6fc66fd5744ab3f64b1258f
size 5324