MCPcopy Index your code
hub / github.com/mailvelope/mailvelope / encryptedMessage

Method encryptedMessage

src/controller/gmail.controller.js:68–103  ·  view source on GitHub ↗
({armored, encFiles, subject, to, cc})

Source from the content-addressed store, hash-verified

66 }
67
68 async encryptedMessage({armored, encFiles, subject, to, cc}) {
69 // send email via GMAIL api
70 this.peers.editorController.ports.editor.emit('send-mail-in-progress');
71 const userEmail = this.state.userInfo.email;
72 const toFormatted = to.map(({name, email}) => formatAddress(email, name));
73 const ccFormatted = cc.map(({name, email}) => formatAddress(email, name));
74 const mail = gmail.buildMail({message: armored, attachments: encFiles, subject, sender: userEmail, to: toFormatted, cc: ccFormatted});
75 const accessToken = await this.peers.editorController.getAccessToken();
76 const sendOptions = {
77 email: userEmail,
78 message: mail,
79 accessToken
80 };
81 if (this.state.threadId) {
82 sendOptions.threadId = this.state.threadId;
83 }
84 try {
85 await gmail.sendMessageMeta(sendOptions);
86 this.peers.editorController.ports.editor.emit('show-notification', {
87 message: l10n.get('gmail_integration_sent_success'),
88 type: 'success',
89 autoHide: true,
90 hideDelay: 2000,
91 closeOnHide: true,
92 dismissable: false
93 });
94 } catch (error) {
95 this.peers.editorController.ports.editor.emit('error-message', {
96 error: Object.assign(mapError(error), {
97 autoHide: false,
98 dismissable: true
99 })
100 });
101 }
102 await this.removePeer('editorController');
103 }
104
105 async encryptError(error) {
106 if (error.code == 'EDITOR_DIALOG_CANCEL') {

Callers 1

transferEncryptedMethod · 0.45

Calls 6

formatAddressFunction · 0.90
mapErrorFunction · 0.90
removePeerMethod · 0.80
emitMethod · 0.45
getAccessTokenMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected