How to use the mime.toMimeObj function in mime

To help you get started, we’ve selected a few mime examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github duo-labs / isthislegit / clients / chrome-extension / src / js / app / service.js View on Github external
ForwardMessage(reporter, message, messageId) {
        let parsed = Mime.toMimeObj(message)
        let encodedMessage = Base64.encode(message)
        let emailObject = {
            to: this.settings.forwardAddress,
            from: reporter,
            body: chrome.i18n.getMessage("forwardReportBody"),
            subject: chrome.i18n.getMessage("forwardReportSubject") + parsed.subject,
            attaches: [{
                type: "text/plain",
                name: messageId + ".txt",
                base64: encodedMessage
            }]
        }
        let mimeEmail = Mime.toMimeTxt(emailObject)
        let emailContent = { "raw": btoa(mimeEmail).replace(/\//g, '_').replace(/\+/g, '-') }
        this._API(
            'POST', 'messages/send', emailContent,