Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse decrypted email #62

Open
rezamarandi opened this issue Jun 24, 2019 · 0 comments
Open

Parse decrypted email #62

rezamarandi opened this issue Jun 24, 2019 · 0 comments

Comments

@rezamarandi
Copy link

Hi,
I have two problem with mail-gpg explain in below
first of all i receive email through http payload with Postal gem, the encoded mail is only one file called msg.asc, I created new mail object with msg.asc source in body ..

      def decrypt_message
        return unless mail_object.encrypted?

        response = mail_object.decrypt(password: Rails.application.secrets.pgp_secret_key)
        params[:html_body] = response
        params[:plain_body] = response
      end
      def mail_object
        mail = Mail.new
        mail.body = Base64.decode64(params[:attachments][0][:data])

        mail
      end

Is this the right way for decode ?
and second problem is :
the result is not a mail object , its just the source of email, something like the structure below:
and i couldn't parse this source, any idea about that ?

gpg: encrypted with 2048-bit RSA key, ID 0A8387EEB8F331211, created 2019-06-18
      "reza-dev@stg-consulting.test.de"
gpg: encrypted with 2048-bit RSA key, ID 5CA8644C56CC12BD, created 2019-06-18
      "test-dev-test-de@test.de <test-dev-test-de@test.de>"
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="3c4321aa4bd8591a78df6a5539b7bbb2"

--3c4321aa4bd8591a78df6a5539b7bbb2
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline; filename="msg.txt"

Subject: subject is encrypted too

Why body and subject is encrypted =3F

--3c4321aa4bd8591a78df6a5539b7bbb2
Content-Type: text/plain
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
 filename="Modern.srt"

77u/MQ0KMDA6MDA6MDMsMjM3IC0tPiAwMDowMDowNSw2MzkNCuKAq9qG2LHYpyDYrdix2YEg2YbZ
hduM2LLZhtuM2J8NCuKAq9in2LIg2K/Ys9iqINmF2YYg2LnYtdio2KfZhtuMINmH2LPYqtuM2J8N


--3c5991aa4bd8591a78df6a5539b7aaa2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant