Yes, you need to set up a mail.app rule. I have an email rule that says any time an email comes to our Sales@ email address with a pdf attachment (this would be a purchase order from a customer), then several things will happen. The mail rule will invoke a Script that will save the pdf to the desktop (which is nothing more than a folder), will automatically print a copy of that pdf on our office printer and will make the computer speak the words "show me the money."
Below is a copy of my script that gets ran every time a pdf is emailed to us. You only need the first part; saving jpg's (or whatever other image files you may want) to a folder that you specify. So you need to write a script and create an email rule. That's it.
using terms from application "Mail"
on perform mail action with messages theMessages for rule theRule
set theOutputFolder to "Macintosh HD:Users:Milly:desktop:"
tell application "Mail"
repeat with theMessage in theMessages
if theMessage's mail attachments is not {} then
repeat with theAttachment in theMessage's mail attachments
set theFileName to theOutputFolder & theAttachment's name
try
save theAttachment in file theFileName
on error errnum
end try
end repeat
end if
end repeat
end tell
tell application "/Users/Milly/Library/Printers/Milly Office Printer.app"
print file theFileName
end tell
say "Show me the money"
end perform mail action with messages
end using terms from
[doublepost=1476360836][/doublepost]Here is what my mail.app rule looks like that runs the script above.