Introduction

Every office maintains their own system to maintain the entry time of their employees inorder to make sure they are maintaining office hour properly. For my case i need to send an entry mail composed with my formal signature and the time. At my work, i usually forget to send the entry mail to the boss. So there may be some confusion whether i have attended office today in time or not. So i have decided to create an application that will help me to solve my daily problem. Today i am going to describe my way to do this.

Background

I usually forget to send my entry mail in due time. For this reason i have decided to develop an application to do this task for me. It is actually more easier for programmers to develop an app other than to memorize to do a task. That's why the task scheduler idea came. I have also made an installer for programmers easy use, if any one wants to use it without having programming knowledge. So let's start.

Using the code

Eventually i have deployed all possible ways to make it user friendly. I have kept in mind that non-programmers may use this application. So i developed it like that way. In my first section i will describe the programming methodology that i have used in my application and in the second section i will describe how to use my application.

First Section:

First of all we need to understand the scenario of the application we are developing.

Here it is :

We need to develop an application that will send mail automatically when the computer starts.

We need to take input from user the mailing address (To) , network credentials and of course the user's mail address.

Then we can add some signature or other necessary information that we want to send with the mail.

Then we will shoot the mail.

Now the scenario is clear that what we are going to do and i am now describing how and why we are going to do this with detail elaboration with code segment.

We will start from the second point that is "We need to take input from user the mailing address (To) , network credentials and of course the user's mail address. "

So here are the situations that may arise.

User can put wrong mail address, So we need to verify that the email address maintains the standard format.

Here in my case i am taking name,email,phone and designation as inputs from user. So i need to validate the phone number too. At this moment i have only allowed the phone number of U.S. as valid. So if you are from another country please kindly change the code to validate the phone number of yours.

If you look at the above code you will see that i have commented out the pattern for phone number of Bangladesh. If you need to assign phone number of others country please add a regular expression for you phone number. That will work fine.

or If this cause any problem you can simply just modify the text file of you D: drive and put your required information there. but not more that 4 paragraphs and also you have to maintain the format of the code that is name,email,phone & designation. You will be able to change everything except the mail address, you need to keep mail address at the 2nd paragraph to perform the task properly.

So we have taken inputs from user after validating all the above criteria. Now we need to save the file. I have saved the file as "info.txt" in the D: drive of your computer. When you will run this project it will create two files.

The first one is named "info.txt" for holding information of the user and the second one is named "date.txt" for checking if the mail has already been sent for the day.

Now we need to Configure the mailing address of you application.

We need to put mailing address (To) and network credentials.

Mailing address (To) is required to send the mail to a particular address. That is our "To" of the typical mail protocol. Network credentials are required because we needed to send mail to a varieties of mail addresses. That's why we need to go through a mail address that i have access. It maintains the format like below.

It means we are using gmail as smtp client and the network credential that you will provide in _credentialMail & _credentialPassword.

For example: Let we have 3 mail addresses like below.

Address 1: x@x.com

Address 2: y@y.com

Address 3: z@gmail.com Password:12345

Now think we want to send an email to <y@y.com> from <x@x.com> So we need to put it like below to work it for this example

To : y@y.com

Network Credential Mail Address: z@gmail.com

Password of the Above Mail Address: 12345

We have saved these information to a text file named CredentialInfo.txt to the D: drive. Here you need to know that i have only configured the credentials for gmail. So the Network Credential Mail Address must be a gmail address.

Step 4: go to the D drive of you computer and change the date to the previous date replacing the current date.

Step 5: Press the Send Mail button. The mail will be sent to the address you have entered to the mailling address. You will find a logo downloaded to your drive. You can also prodive your own logo or your company logo. To do this you need to put the link here.

Note that: There are two seperate projects. Both of them are working. You need to seperate the two projects by replacing Application.Run(new auto_mail()); with Application.Run(new Home()); or replacing Application.Run(new Home()); with Application.Run(new auto_mail()); To send automail do the last one cause by default i have coded the first one.

Step 5: if it promots that you are not registered then register like the procedure i told earlier.

Step 6: close the window -> change the date of the date.txt file as earlier and put the date previous date of today's date -> save the file.

Step 7: run the automail.exe again. then the mail will be shoot now with necessary informations and the informations will be saved in the database and you will see the window below if everything goes right " />

If you want to shoot your mail when the computer starts then follow the steps below:

Step 3: Click on Tab Triggers- > then new . Then select the following as like as the input of the image. Set Active and expired date as you like to trigger the event. and put some delay if you are using modem to connect you computer to internet.

Step 4: Then click on action tab and do the following. browse the automail.exe on your desktop.

Step 5: We are done here . You can check the task by right clicking on the task and then Run the task.

Share

About the Author

I am Palash Debnath. I have been working on windows technologies since 2008. I started with ASP.NET. Then I moved to Windows Form and from the last year I have been working with Windows 8 app development. My future plan is to work with Windows 10 app development as well. I have completed my Undergraduate from Khulna University of Engineering in Computer Science & Engineering. Now I am working as a Software Engineer at Cefalo on Windows 8 app development.