Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Email solution independent from web site

Posted on 2006-06-23
5
Medium Priority
?
228 Views
Last Modified: 2010-04-17
Hi,

I have a fairly big web site that might be sending hundreds of emails on one go, basically i want to create a independent tool to send these emails, I want it independent because it will be used by the main site (ASP) and by a web service (.net), and also because i don't want the web site to crash if some problem happens with sending the email, so i don't want it IIS managed!. I was thinking on a Console application (.net) but i don't know if ASP would be able to use it! I'm open to any suggestion as long as they are appropriate. Technically the tool should load the data from a database and send the emails on a queue (is this the SMTPs job or should it be the tool?).

Thnks for your help

Regards,
0
Comment
Question by:JunkMan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:fernandonajera
ID: 16976379
If I've read your question right, you want some kind of batch send mail. This is one approach.

First of all, create a table in your DB with basic fields: from, to, cc, bcc, subject, message and maybe attachments (that can be a little more complicate, but is doable). Even a priority field could be valuable (to send the signup emails earlier than the regular mailling list emails, for instance). Also include a status field: not-sent, sent, failed. Maybe a datestamp field to know when you sent it. You know.

In your ASP page, insert into that table any email you want to send. Then say to the customer something like "you're emails are going to be send in the next few minutes.".

Then, write a Windows Service (in .NET if you want to). Place parameters for connection string, table name, smtp server, user and password, and so on in app.config. In the main loop, place a timer - maybe to trigger each 5/10 seconds.

In the OnTimer, do a query to retrieve all the not-sent emails. Then for each of them, try to send them. If OK, update the row for status to be set as sent. If error, also update the row. When no more rows are to be processed, sleep for the next timer call.

And that's it! Let the SMTP Server deal about the delivery queue.

If you need it, there is an interesting Opensource SMTP component that you can use if your mail server uses a non-standard port or if you need to authenticate first. It is at http://sourceforge.net/projects/opensmtp-net/
0
 
LVL 3

Author Comment

by:JunkMan
ID: 16978472
Hi,

Thanks, that's exactly what i wanted, just a couple of questions, i will be developing the Windows Service in my local machine i do i go deploying it to my production server? Do i need to setup any scheduling for it to run at? Or i can incorporate it whitin the service? I have never developed on of these any further help would be apreciated, i would increase the points of course...

Thanks,
0
 
LVL 4

Accepted Solution

by:
fernandonajera earned 900 total points
ID: 16978620
If you develope your Windows Service in .NET, you just need to xcopy the bin folder to the production server and then run a simple command:

installutil path\to\file.exe

InstallUtil is a program included with .NET Framework (usually at %windir%\Microsoft.NET\Framework\version\installutil.exe) and is responsible to install and uninstall windows services programmed in .NET. (FYI: installutil /u to uninstall).

Of course, you can do an installer for this. Maybe the installer project included in VS.NET can be used - I don't know, because I've always used Inno Setup which I found more... understandable.

Windows Services has 2 main events: one launched when the service starts (OnStart) and one launched when the service stops (OnStop). In OnStart, you should create a Timer object, attach your event handler to it, and start it. In that eventhandler (Timer.OnTimer) you'd process your enqueued messages as described in the other post. You'd only stop the timer in the OnStop event - when the service is going to shutdown.

If you need more information let me know.
0
 
LVL 3

Author Comment

by:JunkMan
ID: 17036116
Sorry fernando, i'm on hollidays and i totally forgot to accept your answer, it works as a treat, although OpenSMTP is a bit buggy, i've decided to go with ASPEmail as i had already bought the ASP version and they now have a .NET Lib.. Thanks anyway. I've increased 100 points to the question..

Thanks once again!...
0
 
LVL 4

Expert Comment

by:fernandonajera
ID: 17036284
I told you about OpenSMTP because it is free, but of course any other email component will work. Anyway, I'm glad my solution was useful. Good luck!
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Introduction to Processes

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question