目前电子邮件可通过ability拉起,通过拼接uri传递参数mail({ subject= '', recipients=[], body='', ccRecipients=[], bccRecipients=[] }: mainOptions, callback: Function) { let mailUri: string = ''; mailUri += recipients?.join(',') || ''; mailUri += '?cc=' + ccRecipients?.join(',') || ''; mailUri += '&bcc=' + bccRecipients?.join(',') || ''; mailUri += '&subject=' + subject; mailUri += '&body=' + body; Logger.info(TAG + 'mailUri ', mailUri, 'ccRecipients:' + ccRecipients, 'bccRecipients:' + bccRecipients); this.startEmailApp(mailUri, callback); }startEmailApp = (mailUri, callback) => { let want: Want = { bundleName: 'com.huawei.hmos.email', abilityName: 'EntryAbility', moduleName: 'entry', uri: 'mailto:' + mailUri, action: 'ohos.want.action.viewData', }; Logger.info(TAG + 'want ', JSON.stringify(want)); try { this.ctx.uiAbilityContext.startAbility(want) .then(() => { Logger.info(TAG, 'startAbility success'); }) .catch((err: BusinessError) => { Logger.info(TAG, 'startAbility error.', err.message); callback(err.message); }) } catch (e) { callback(e); Logger.info(TAG + 'error:', e); } }
目前电子邮件可通过ability拉起,通过拼接uri传递参数