Web forum page <-> e-mail account bridge - how to start?

  • Thread starter Thread starter Dobieslaw Wroblewski
  • Start date Start date
D

Dobieslaw Wroblewski

Hi,

I am a total newbie in the Internet programming, so I would like some
general advice of "what to start from" kind.

First I will explain what I want to do:

Suppose there is a web page that requires a logon, and then the logged user
can add her/his comments... so this is a kind of a forum page P.
I want to write an e-mail client program that:
- will periodically send any changes detected on the forum page to a
specified address A,
- will process e-mails from A and add it as comments to the forum page P.

I know what URLs should be send to a web browser in order to log on and to
send a comment to P. Anyway, I would not like to use a web browser, maybe
just its engine or api. I would like the application to be user friendly,
i.e. not popping up with IE windows and not using many resources.

So... what to start from?

DW.
 
Hello DW,

So you want to write a server component that will do two things:
1) detect incoming e-mail, parse it, and post the contents to a forum, and
2) detect changes in a forum, encapsulate those changes in e-mail, and send
them.

The first one is a bit harder, because your app has to be always running.
Best to consider using a POP3 server that will capture incoming e-mail for
you and write it to the hard drive. You can configure the SMTP components
of IIS to do this. Sending out e-mail can also be done with the SMTP
components, as long as you have an upstream SMTP server provided by your ISP
to redirect the messages two when you cannot resolve them locally.

So using SMTP in IIS, your application gets simpler:
1) detect a new e-mail message on the hard drive, parse it, and post the
contents to a forum, and
2) detect changes in a forum, encapsulate those changes in e-mail, and send
them using .NET SendMail.

Now, in order for #1 to work, your app has to be running all the time. You
can do this by writing a windows service, or you can write your app as a
console application and simply schedule that it should run using the Windows
scheduling service. Pick one. I prefer having my app called by the windows
scheduling service, so I will assume that. The alternative is very similar,
but there's some overhead with setting up your own service. Google "create
windows service .NET" to find articles.

Since apps running from a service cannot have a U/I, your app will be a
windows console application.

You can use the WebClient methods to get and post information to and from a
web forum. Note that you will want to find this code on the web and copy
it. There are common mistakes you can avoid by doing this. For example,
since the site requires a login, you will probably have to request the login
form, capture the cookies, and then post the form containing the userid and
password along with the cookies. You will need to keep posting these
cookies for the rest of the session (which is what allows the web server to
identify you).

This is a complicated application for a person who is a newbie to internet
programming.

I would suggest that it may be easier to do this is parts, so that you can
be fairly sure you know how one part is working before moving on to the next
part.

I hope this helps,
--- Nick Malik
Applications Architect
http://weblogs.asp.net/nickmalik
 
I have made some trials with the WebClient class, and the part 'forum ->
e-mail' seems quite easy (actually, the preliminary dirty code is about 20
lines, so that was a really easy one ;-).

The other part seems more dificult. I know something about SMTP/POP3, so I
think I will manage... the thing that seems more difficult to me now is to
talk to the web forum page, keeping the state of the connection. I tried to
read something about HTTP but at the moment I find it very complicated.

Anyway, thanks for your help.

DW.
 
Back
Top