Programming to Read and Send email
I would li开发者_StackOverflowke to create a program that does the following:
1. Monitor all emails received at an address that I own, e.g. subscribe@mydomain.com 2. Read the From and Cc fields and insert those email addresses to my database 3. Parse the body of the email to find a certain text, such as a 6-digit registration code (assume I already have the logic to do the parsing) 4. Reply the emails from a template that includes the registration code and some other data retrieved from my databaseTo make my job easier, I would like to leverage any relevant services out there (maybe SendGrid, apinbox.com, etc.). Ideally all the servers are hosted somewhere in the cloud.
My question: Can you recommend the best way to do the above? You can consider me a total newbie in developing such programs, so please be gentle :-)
I don't know anything about the services you mention but It's fairly easy to write an app to do basic emailing in VB.Net. The built in SmtpClient class makes it easy to send emails, and there's plenty of projects on codeproject.com that shows how to read emails (just search there for POP3). The POP3 protocol isn't very difficult to implement, but it can be a little bit more difficult to handle MIME encoded content, but as I said, the projects at code project should show you that.
However, reading your question more carefully it sounds like you just want to have some automated way of sending out registration codes. If so, it might be worth to check if there isn't already services that'll do that for you. I'd suggest looking into that at some forum for Shareware Developers. One group I've heard of is the Association of Software Professionals, they might have some forum or advice about that.
If you are interested in a hosted service to handle the email parsing and conversion to HTTP POST I would recommend looking at a few like: http://mailhooks.com (free) http://mailnuggets.com (not free, but new and cheap). If you consider yourself a programming newbie, I would consider posting to a simple PHP script to test it out, like this:
<?php
// put the code below in a file at yourwebsite.com/test.php
// and POST your email to it as a test.
$postArr = print_r($_POST,1);
$log = "postLog.txt";
$fh = fopen($log, 'w') or die("can't open file");
fwrite($fh, $postArr);
fclose($fh);
?>
This will log the posted contents to a file called postLog.txt. Some of the mail processing services mentioned above may also have sample code to help out.
精彩评论