send emails automatically at a particular time without running application - c#

I need to automatically email the contents of a datatable daily at a particular time(10AM and 8PM). Without running the application how will i achieve this.. Please help me.. How to autogenerate emails at a particular time

You can use sql mail write a stored procedure that runs on a schedule using job services. Don't need c# and console app is a pain to build deploy and another app to manage.

Related

Can we use a windows service for a web application which can trigger a mail on specific date and time?

I am creating a web application which will trigger a mail but the mail will be trigger on specific date and time(with the help of web application).
I am not understanding that how can I achieve this in web application.
Does windows service is the solution for this ?
Please let me know which is the best solution and how do I do this using c# code?
Thanks in Advance.
You can use FluentScheduler.
Install-Package FluentScheduler
Then you can add the code like below:
Schedule(() =>
{
//mailingJob or anything else you want to do
}).ToRunOnceAt(yourSpecificDateTime);
For more info go to https://github.com/fluentscheduler/FluentScheduler
Yes, you can achieve this, you will need
Database
Windows Service
Web application
First create a database which is the same for your application and service.
Create a UI in your web application which sets the date and time of the mail to be sent. Then save this data in the database.
Now, in the windows service (assuming you know windows services), just check the date and time from the database and send the mail accordingly.
To create a windows service you may find these links useful
http://www.aspsnippets.com/Articles/Automatically-send-emails-daily-at-specific-time-using-Windows-Service-in-C-and-VBNet.aspx
http://www.c-sharpcorner.com/UploadFile/ee01e6/create-windows-service-and-send-mail-daily-on-fixed-time-usi575/
Just get the time from your database and check against that time and you will have a dynamic service.

Direction on how to run PowerShell script to create email box on Exchange server

Here's what I'm trying to accomplish: users have a need to create an email address through a web app (basically, it uses existing information to create custom, unique email addresses). Currently, the web app just generates the name, then they turn it over to us, and we run a PS script on Exchange to create the box. I'd like the box to be created when they request an email on the web app. There's probably like 10 ways to do this, but I'm thinking it would be a webservice that passes the email name to a Windows app on Exchange that executes the script and returns Success/Failure/Etc.. Does this seem viable. I'm not sure how to thread the process of running the PS script. Does anyone have any thoughts? I'm not looking for someone to write the code, but perhaps have some architectural ideas.
There are several methods but the "easiest" one that pops into my head is as follows:
User logs into create-an-address web app
They submit a request into the app which stores the data in a SQL table (if exists)
STSS/DTS package produces a CSV output of date+ new entries and drops it into a Temp directory
Or skip the database and create/append a daily CSV-formatted file direct from the web app.
Scheduled job runs the powershell script which parses the CSV via for-each and creates users & mailboxes as needed. If user exists, only add smtp to existing mailbox or whatever your requirements are
Powershell deletes the file if success or moves to another folder for investigation if failure occurs.
We've done similar data ingestions for various applications and it works well. We add email events into the script for success/failures but we like the database approach because can ingest the CSV status with other STSS packages for historical reporting

Schedule and Send reports automatically using asp.net vb

I want to create a scheduler to email reports automatically in asp.net vb. I will set parameter for report and save it in the database. This report will be send automatically on the scheduled time.
I need some guidelines to start working on it. How will I send it OR how the system will recognize the schedule time and email the report.
If you want to go automatically, you will need to create a window application not asp.net. You can simply add a window application to generate crystal report and send mail.
Now how it will work automatically, you need to create a window task as below any of one links. In that you can give your exe path and give date and time schedule to run this exe.
http://www.makeuseof.com/tag/how-to-automate-windows-programs-on-a-schedule/
http://www.techsupportalert.com/how_to_schedule_programs_to_run_automatically.htm
In asp.net side, this can not do this.
There are free crystal reports schedulers. Why do you need to rediscover the hot water:
http://www.r-tag.com/Pages/CommunityEdition.aspx
http://www.groffautomation.com/

asp.net or windows service that listen to if you get a Email

I am trying to make a program that will listen to if I recieve a E-mail I got a smtp server and so on.
I want to make a database object with Title and text from the Mail and I might want to evolve it into also saving the attacted file to the database so I can use it it my asp.net program.
I think I need a windows Service that will be listening to the email if it gets a email it will add it to datbase and wait again but I am not sure how to do that. if its possible to program that into my asp.net project then it would be a good thing also
Here is a small design on how I was thinking about it
if you know anything about it feel free to come up with any kind of solutions for me.
Read incoming emails with POP3 or Exchange. I've made something similar before, which was a system where users could add links (a type of linking-scam actually) to different websites. So there was a bunch of people in Asia that had a full-time job searching for relevant sites and emailing a list of these URL's to a specific email-address. A service I had running would check the POP3 inbox every 5 minutes or so and then post these links to the website.
You should make an application that gets run at specific intervals rather than a service, which is much simpler. If you're using Azure as a host you can use the scheduled task service there to make a POST call to a page on your site so you don't have to run the code in a different eco-system. Well, I guess you can do that anyway with scheduled tasks in windows.
Here's a POP3 client for .NET
You could make a C# service that checks the pop3 server in a configured interval, and store them in the DB. There's something like this here:
http://aspsnippets.com/Articles/Fetch-and-Read-emails-from-POP3-mail-server-using-C-and-VB.Net---Part-I.aspx
But as a regular application, you just have to make it to run as service (I think you have a project template for that in VS). You have some info here:
http://msdn.microsoft.com/en-us/library/zt39148a(v=vs.110).aspx
Okay I figured out a good solution for this problem friends :)
What I did was I downloaded the EAGetMail and implamentet it. it basicly works for you in a time interval it will check your mail and make a txt file with all the mails so it wont read it again. it also got a aplication field so everytime it runs it will run the selected application.
So I made a console application that runs trough my folder where it will save all my email's as .eml file. It will check for a sub folder called read if its not there then create it and then check the root folder for .eml files read them and save information from it to the database and then move the file to read.
We did not want to use pop3 cuz we wanted the mails to stay intact så we dont lose any information. so we ran for the IMAP4.
and in the asp.net I just run a query that checks the database and use the files.

continously running thread in asp.net web application

i want a continously running thread in my web application for sending mail to admin if the logged complaint of the user in not solved by technician within 24 hours.
i am able to send mail to administrator
i just want a watch on database for unsolved issues with timespan of more than 24 hours and inform to administrator about the same
how can i perform it. any ideas
Create an aspx page/asmx service to check the database and send email providing appropriate check in the page/service. This page/service can then be called using PowerShell script on the server, and that powershell script can be scheduled to run in task schedular using specified intervals. Hope this shall acheive what you wants.
The right way to do it would be to write a Windows Service which will monitor the database and send emails out.
If your asp.net web application uses sql server, which i imagine it does, i would reccomend creating a sql agent job which executes some sql with the business logic you desire, and sends emails using the built in sql server email sending functionality
SQL Server Agent Mail
1) Windows service which will monitor the table
2) SQL Job

Categories

Resources