In this tutorial we will learn how you can send an email from your computer when somebody login either for a specific account lets say a Windows Guest Account or For all the accounts if you have multiple users on your home desktop.
What we will use :
- Windows Task Scheduler
- An SMTP server which binded to your computer for authentication
- In case SMTP server does not work, we will use command line program Send Email, which sends email with attachment. Download this.
Sending SMTP Mail from a Command Line :
Let us understand this part first. Send Email is a SMTP email client which is capable of sending email from command line which means any program which is capable of running command line execution when it starts or ends can use this.
There are a lot of options available for this program so I will keep this brief :
- -f : from
- -t : to
- -u : subject
- -s : smtpserver:port number
- -xu : smtpusername
- -xp : smtp password
- -o : tls
-f [email protected] -u Guest Login -t [email protected] -s smtpserver:port -xu [email protected] -xp sptmpassword -o tls=yes
Keep this configured in a notepad and this will act as option when you invoke Send Email from Task Scheduler.
Configuring Windows Task Scheduler :
- Open Task Scheduler. You can search or look into control panel.
- Right click and choose Create Task.
- Here you need to give it a name, choose to run under highest privilege, Mark it as hidden and configure it for your Windows. Also choose to run it weather user is logged or not. At the end it will ask you for password of your account. Add that too.
- Done this now select the tab which says Triggers.
- Add New Trigger and choose At Log on. Under settings choose Specific user and specify that account. You can also make it run selecting Any user.
- You can delay a task by 10 minutes if you think connection to internet might take sometime. In case your internet connection is always on, ignore.
- Now move to the next tab, Actions. Here you will need to choose between Start a Program and Send an Email.
- If you have SMTP connected with your computer already and needs no further authentication select Send an Email. Then you can fill in email id, subject line, text and attachment. Then type in the smtp server url and you are done. Skip Next Two step.
- In case you do not have SMTP server, select Start a Program and browse to find the Send Email program you downloaded.
- Then copy the parameters which we discussed in start of the post and add it to the Add Arguments section and Save.
- Now it is possible that the program might fail sometimes to complete. So make sure you have set it to run at least 2-3 times by settings the option under the Settings Tab.
- Save everything and exit to test if it works under guest account or create a dummy account to test.
Done this anytime a user login your account you will get an email. The only trouble shooting you will need is configuring the SMTP account to send the mail across. If you get that right the mails will be sent to you quickly.
How about in Windows XP? is like that can also do in WinXP? and how to do it?
How would you get the ip address and date time of login ?