topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Monday March 18, 2024, 11:10 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Auto print Email Attachment  (Read 5639 times)

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 118
    • View Profile
    • Donate to Member
Auto print Email Attachment
« on: July 21, 2017, 08:15 AM »
Hi All

Not posted he in a long time!!

What I need, is a simple standalone prog, perhaps minimised in the systray and sits a monitors a given POP email account r something like a GMAIL account ( I would obviously need to set the username/pass etc)

Then, when it find an email, it automatically prints (to the pc's default printer) any attachment to the email (not the whole email body itself, just the attachment).

Could have added options such as the option the delete/forward the email after being processed
Set the time delay for the check
 etc

But essentially, that's it.

If no one is interested, I will put together myself, but just putting it out there if anyone wants to give it a go, or if anyone is aware of something like this already?

I really do want it as simple as possible, and nice and portable?

Cheers

Awop
_____________________________________________
J.

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: Auto print Email Attachment
« Reply #1 on: July 22, 2017, 07:10 PM »
 :) PrintMail is a wrapper for getmail.exe from http://www.interlog....charron/getmail.html.

Just add your user information, save the file as PrintMail.ahk in a folder, download and place getmail.exe beside it, and it will extract and print the attachments, and move the files to the Printed folder.
Download and install AutoHotkey to run the script.

Skrommel

23.07.2017: Added option to set target printer

;PrintMail.ahk
;  Print mail attachments, uses getmail.exe from http://www.interlog.com/~tcharron/getmail.html
;Skrommel @ 2017

target=Printed
popserver=
port=110
username=
password=
pause=60
deletefromserver=0
printer=

#NoEnv
#SingleInstance,Force
SetWorkingDir,%A_ScriptDir%

If deletefromserver=1
  delete=-delete
If printer<>
  printer=/d "%printer%

FileCreateDir,%target%
Loop
{
  RunWait,cmd /c getmail.exe -u %username% -pw %password% -s %popserver% -port %port% %delete% -xtract,,Hide
  FileMove,MSG*.txt,%target%
  Loop,*.*
  {
    If A_LoopFileName In PrintMail.ahk,PrintMail.exe,getmail.exe
      Continue
    RunWait,print %printer% "%A_LoopFileName%"
    FileMove,%A_LoopFileName%,%target%
  }
  Sleep,% 1000*pause
}
« Last Edit: July 23, 2017, 05:57 AM by skrommel »

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 118
    • View Profile
    • Donate to Member
Re: Auto print Email Attachment
« Reply #2 on: July 23, 2017, 02:36 AM »
Nice one

Will give it a try.
_____________________________________________
J.

awopbamboo

  • Honorary Member
  • Joined in 2009
  • **
  • Posts: 118
    • View Profile
    • Donate to Member
Re: Auto print Email Attachment
« Reply #3 on: August 05, 2017, 02:54 AM »
Hi

Sorry, only just got round to testing this!

I downloaded getmail from the link you supplied, but immediately, Windoes Defender said it malicious and not to run it?  Any ideas if it is dodgy?

Ta

J.
_____________________________________________
J.

skwire

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 5,286
    • View Profile
    • Donate to Member
Re: Auto print Email Attachment
« Reply #4 on: August 05, 2017, 07:27 AM »
I downloaded getmail from the link you supplied, but immediately, Windoes Defender said it malicious and not to run it?  Any ideas if it is dodgy?

This is a false positive.  Anti-virus programs often flag email-related (especially commandline) programs as malicious as they are seen as potential spamming tools.  This particular program has been around forever and I've used it, along with Tim Charron's (same author) Grep, for many many years.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,958
    • View Profile
    • Donate to Member
Re: Auto print Email Attachment
« Reply #5 on: August 05, 2017, 07:35 AM »
I downloaded getmail from the link you supplied, but immediately, Windoes Defender said it malicious and not to run it?  Any ideas if it is dodgy?
odd,
MSE has no complaints about it - and they both use the same anti-virus updates

Virustotal says:
SHA256:    7504cd82fc5af60fb14315b222e9c413e746e42c05c86d5096245002d6797d4d
File name:    getmail.exe
Detection ratio:    1 / 63
Analysis date:    2017-08-05 12:32:49 UTC ( 0 minutes ago )
"Cylance" gives it the thumbs down but note (& see Skwire's comments above) --
the file is nine years old and it has been checked there multiple times -- I assume that if there was any real problem with it, it would be commonly known by now
Tom

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
Re: Auto print Email Attachment
« Reply #6 on: August 07, 2017, 08:56 AM »
I've used GetMail for several years, with no problems. :)