Jump to content

hMailSever Task Complete Detection


Recommended Posts

Hello AutoIt community.

My Scenario is:
1-MX Server(Main Server-VPS)with Linux Debian Jessie, Postfix + Dovecot(DKIM,SPF,SpamAssasin, ClamaAV,TLS,SSL,Fail2Ban)
2-hMailServer Local Network with SMTP Relay and External Account(Catch All Account).

Everything is working properly.

-The hMailServer on Local Network will have Internet connection every 3 or 4 hours.
-An AutoIt script will be running and connecting to the Internet this Server through a captive portal.
-Once connected AutoIt will Fetch the External Account and Send All the emails on the Delivery Queue.

How do I determine/know when all the emails are sent or downloaded?

With this AutoIt code(very simple just for testing purposes) I'm able to Force hMailServer to download the Email for the external Account and Send Everything with StartDelivery():
 

Func SendAll()
    Local $oMail = ObjCreate("hMailServer.Application")
    $oMail.Authenticate("administrator","your-password")
    Local $oSend = $oMail.GlobalObjects.DeliveryQueue
    $oSend.StartDelivery()
EndFunc

Func DownloadAll()
    Local $oMail = ObjCreate("hMailServer.Application")
    $oMail.Authenticate("administrator","your-password")
    Local $oDomain = $oMail.Domains.ItemByName("your-domain.com")
    Local $oAccount = $oDomain.Accounts.ItemByAddress("vpop@your-domain.com")
    Local $oExtAccount = $oAccount.FetchAccounts.Item(0)
    $oExtAccount.DownloadNow()
EndFunc

Any idea how to check when Send or Download is completed?

My goal is to check when the Server Finish downloading from the POP3 server(could be 100 emails or 300 emails) and also wait the Server Finish sending all the emails on the DeliveryQueue(could be 100 emails or 300 emails) and then disconnect this computer from Internet.

Note: In some countries Internet access still insanely expensive and slow, as an example in Cuba 1hour of internet access = 2.10USD and the monthly average salary is 35USD-40USD for some doctors 50USD. So as you can imagine having this server connected to Internet permanently is not an option.

Kind Regards
Alien.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...