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

How do I read the mail content? #91

Open
fifiteen82726 opened this issue Jul 6, 2017 · 1 comment
Open

How do I read the mail content? #91

fifiteen82726 opened this issue Jul 6, 2017 · 1 comment

Comments

@fifiteen82726
Copy link

I am doing this way

require 'gmail'
USERNAME = 'xxx'
PWD      = 'xxx'
gmail = Gmail.new(USERNAME, PWD)

gmail.inbox.emails.count
# 7394

gmail.inbox.emails.last
=> <#Message:70327319034880 mailbox=inbox uid=9818>

gmail.inbox.emails.last.message
=> #<Mail::Message:70327319519480, Multipart: true, Headers: <Return-Path: <3pKNdWQgTCzMcd-gTeanPRRdjcih.VddVaT.RdbclaXj.QdcXdVbPXa.Rdb@gaia.bounces.google.com>>, <Received: by 10.28.223.9 with SMTP id w9csp1538501wmg; Wed, 5 Jul 2017 19:42:45 -0700 (PDT)>, <Received: from mail-pg0-x245.google.com (mail-pg0-x245.google.com. [2607:f8b0:400e:c05::245]) by mx.google.com with ESMTPS id o27si405612pli.602.2017.07.05.19.42.44 for <[email protected]> (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Jul 2017 19:42:45 -0700 (PDT)>, <Received: by mail-pg0-x245.google.com with SMTP id z1so6207408pgs.10 for <[email protected]>; Wed, 05 Jul 2017 19:42:44 -0700 (PDT)>, <Date: Thu, 06 Jul 2017 02:42:40 +0000>, <From: Google <[email protected]>>, <To: [email protected]>, <Message-ID: <[email protected]>>, <Subject: =?UTF-8?B?5bey5ZWf55So5a6J5YWo5oCn6LyD5L2O55qE5oeJ55So56iL5byP5a2Y5Y+W5qyK?=>, <Mime-Version: 1.0>, <Content-Type: multipart/alternative; boundary="94eb2c13fab041830a05539d12b1">, <Delivered-To: [email protected]>, <X-Received: by 10.99.168.5 with SMTP id o5mr8840927pgf.207.1499308965091; Wed, 05 Jul 2017 19:42:45 -0700 (PDT)>, <ARC-Seal: i=1; a=rsa-sha256; t=1499308965; cv=none; d=google.com; s=arc-20160816; b=N9DVXsaM9TeDXane6vYKW+PqtcqM14XXg2l1fyxqTOEbFU75vDgjSOLl+owgRoLQtd jG7NsfIJDdRlTIANErF6P3bbrS2vYZ2LluCOZsb9PQ3QcTov+HXPLVo6OJBUKs3zH/s0 R4RyvEUJgxh3f4wgIyAfE34tzlAjnety974dKcTLgaWpLMl/dRJRC9e2CZ0Iynkrk+Ct 9o1YfAh7ZFCvVoXxsa4jWgGVfuYkjNhlj90TESJClpJa4YscFNr5AZiXkMuUOyD+imJb EO0abA8GqmJ4wyfc+0OHcWmCBTorvKYDB7V6xo8yodIfzlnB7U8Gia5u4Pgj4g6br7zw W5Kw==>, <ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:message-id:feedback-id:date:mime-version :dkim-signature:arc-authentication-results; bh=J8tuWNX9MU59+l6fzokgEdFYDHN6NqIS4Z5md7SzPv8=; b=aWj9kKK81awzTiDEcm8tW8T5hWrsKkOwsk0EBjmH4IrBKBjzX2KC5MDOKO7e7qzsx0

It seems the message is unreadable, how do I extract the content, sender and more information?

@0x1eef
Copy link

0x1eef commented Jul 6, 2017

try message.parts and check out the documentation for the "mail" gem, the object returned by the message method is from that gem.

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

2 participants