[MAIL] How to export multiple emails to PDF with the date of receipt in the name ?

Hi everyone,


From Mail, I would like to export my thousand of emails as PDF, rename them with the date of receipt and the subject. I’m looking for this format [YYYY-MM-DD_Subject].


I tried to find a way with Automator.

First I exported my old mails to PDF then I used the action « rename finder items ».



The problem, Automator will use the date when I created the PDF, so the date of today and not the date of receipt. I didn’t find any action to rename an email before exporting it.


So I need an AppleScript in Automator or Mail to fix this problem.

It seems like the best way is to add a new rule in Mail and to run an Applescript.


I found an interesting article but this Applescript will only save the email attachments :

http://www.macosxtips.co.uk/index_files/automatically-save-mail-attachments-using-applescript.php


And I’m not the only one looking for an Applescript recently :

https://stackoverflow.com/questions/60921232/applescript-to-save-email-as-pdf


I don't know how to write an AppleScript, if you can help me, I will be very grateful.


Thank you in advance for your answers.

MacBook Pro

Posted on Apr 20, 2020 11:52 AM

Reply
2 replies

Apr 22, 2020 7:12 AM in response to Space_jeff

Hello Space_jeff,


Thanks for using Apple Support Communities! I see you have some questions about using AppleScript with the Mail app, and I'd like to do what I can to help.


I was able to find some information on using AppleScript with the Mail app: Use scripts as rule actions in Mail on Mac

This guide is for macOS Catalina, Mojave or High Sierra. Keep in mind that macOS Sierra may work differently.


If you need additional assistance, since AppleScript is considered a developer tool, here are some resources for you:

Developer Forums

Developer support


Take care!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

[MAIL] How to export multiple emails to PDF with the date of receipt in the name ?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.