Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For my email server I wanna send text SMS to users when ever they receive email to their mailbox. How can I periodically check my mail server for every 2mins whether any user had a new email. This must be even when the user is out of mailbox also.

I am using hMailServer for Windows. So, how to perform an action when the mail server receives email.

And this question doesn't mean that checking each email account. If I do that I can nearly check not more than 1000 account for a day. I need all the email account in the server must check for new emails and if new emails are found the user must be notified with SMS that he received a new email to his mailbox.

share|improve this question

closed as too localized by GregD, Ben Pilbrow, John Gardeniers, mailq, rnxrx Aug 28 '12 at 2:42

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

Just out of curiosity, why would you do this? – GregD Sep 25 '11 at 17:40
Just to send text alert to my users that they received new email to their mailbox. What's wrong in it? Its a kind of attracting new users. – Karthik Malla Sep 25 '11 at 17:44
... or a way to spam them with SMS messages. – johannes Sep 25 '11 at 17:52
With email as ubiquitous as it is, it seems kind of redundant to send an SMS message when they get new emails... O_o – GregD Sep 25 '11 at 17:55
@johannes - hehe... spamming with SMS? do you know what is DND? and what is the fine to be paid for sending a single spam message to numbers under DND? I have a SMS gateway to send SMS even to DND numbers but if somebody report I have to pay fine of $100/sms. But how can you send spam with SMS message? who spends to send spam? – Karthik Malla Sep 25 '11 at 18:06
up vote 0 down vote accepted

No problem of doing that. You just need to know how to put it all together:

  1. Read the documentation of hMailServer on how to execute scripts after receiving messages.
  2. Mark every user that received messages in the last period. (Database?!)
  3. Write a second script/daemon that reads all marks, sends SMS for all marked mailboxes/users and after that removes all marks.

Repeat step 3 every x minutes.

share|improve this answer

Typically something like this would be done by setting the users who want this to store a copy of their mail in their local mail box and also forward a copy to the SMS address. In this way they get a notification of new messages which includes part of the message (SMS gateways often have very small limits to message sizes). Or you can set up delivery to a script, if hMailServer supports it, and that script can rewrite the message however you like...

This sort of method means that there's no lag in the time the message comes in and when the message to the SMS gateway is generated.

We use the script method on our mail server (not using hMailServer though), and give our users additional addresses that can be used when they want a message to go to their phone.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.