• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Decoding Quoted-Printable in (Apple) Mail Message Source
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Decoding Quoted-Printable in (Apple) Mail Message Source


  • Subject: Re: Decoding Quoted-Printable in (Apple) Mail Message Source
  • From: Takaaki Naganoya <email@hidden>
  • Date: Tue, 14 Nov 2017 20:16:55 +0900

Now we can easily handle Mail.app message with AppleScript by using MailCore2
framework.

https://github.com/MailCore/mailcore2


—Parse Mail.app’s eml files by AppleScript
http://piyocast.com/as/archives/4406

—Prepare Mail.app’s eml files by AppleScript
http://piyocast.com/as/archives/4397

—Decode attachment files from Mail.app’s eml file
http://piyocast.com/as/archives/4400

--
Takaaki Naganoya
email@hidden
http://piyocast.com/as/

> 2017/11/14 18:49、Christopher Stone <email@hidden>のメール:
>
> Hey Folks,
>
> I've been trying to find a well established method of decoding
> quoted-printable for years, because the source of Mail.app messages is often
> a real mess and hard to parse.  (Parsing becomes much more manageable if you
> can decode QP first.)
>
> I'm still far from being an advanced Perl user, but I keep tinkering and
> slowly improving my fluency.
>
> That said — it occurred to me that as mature as Perl is — and how often it's
> been used to run Internet processes — it would be strange if a module for
> managing encodings didn't exist.
>
> After some detective work I found such a module and learned how to make it
> sit (still can't get it to roll-over though).
>
> (The Perl module in question should be pre-installed in any recent version of
> macOS.)
>
> The appended script makes it much easier to scarf embedded URLs and other
> data out of (Apple) Mail messages.
>
> Enjoy.
>
> --
> Take Care,
> Chris
>
> -------------------------------------------------------------------------------------------
> # Auth: Christopher Stone
> # dCre: 2017/11/13 22:40
> # dMod: 2017/11/13 22:55
> # Appl: Mail
> # Task: Extract the source of the selected message — and decode any
> quoted-printable encoding.
> # Libs: Requires the Perl module MIME::QuotedPrint from MIME::Tools
> (installed by default on macOS).
> # Osax: None
> # Tags: @Applescript, @Script, @Extract, @Source, @Selected, @Message,
> @Decode, @Quoted-printable, @Encoding
> -------------------------------------------------------------------------------------------
>
> set perlScript to text 2 thru -1 of "
> #!/usr/bin/perl -sw
>    use MIME::QuotedPrint;
>
> my ($decodedStr, $messageSource, $shCMD);
>
> $shCMD = qq(
>     osascript -e '
>         # Get Message Source from selected message in Mail.app
>         tell application \"Mail\"
>             set selectedMessage to item 1 of (get selection)
>             set messageSource to (get source of selectedMessage)
>             return messageSource
>         end tell
> ');
>
> $messageSource = `$shCMD`;
> $decodedStr = decode_qp($messageSource);
>
> print $decodedStr;
>
> "
>
> set decodedMessageSource to do shell script "perl -f <<< " & quoted form of
> perlScript
>
> -------------------------------------------------------------------------------------------
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Decoding Quoted-Printable in (Apple) Mail Message Source
      • From: Bob Stern <email@hidden>
References: 
 >Decoding Quoted-Printable in (Apple) Mail Message Source (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Bug or Spec ?
  • Next by Date: High Sierra/script menus/ASObjC
  • Previous by thread: Decoding Quoted-Printable in (Apple) Mail Message Source
  • Next by thread: Re: Decoding Quoted-Printable in (Apple) Mail Message Source
  • Index(es):
    • Date
    • Thread