Programming to Read and Send email - email

I would like 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 database
To 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.

Related

How to store a full email message in django

This is kinda hard to google, so I'm asking here... How would you go about storing a whole email as a django model? I'm planning to archive an email message to a database (parts may also end up in files on disk).
Since I'd like to store as much info about it as possible (while still being searchable), I'd be happy if someone already did the hard work. Only just storing body and the most relevant fields would not be enough in my case.
So the question is: Is there a django app that already provides the models to do this?
There's another question covering models for email messages in general (not Django-specific). For Django models, see the
Message model in django-mailbox, which looks like the most relevant app listed in the email-related grid on Django Packages.

Looking for an email/report templating engine with database backend - for end-users

We have a number of customers that we have to send monthly invoices too. Right now, I'm managing a codebase that does SQL queries against our customer database and billing database and places that data into emails - and sends it.
I grow weary of maintaining this every time we want to include a new promotion or change our customer service phone numbers. So, I'm looking for a replacement to move more of this into the hands of those requesting the changes.
In my ideal world, I need :
A WYSIWYG (man, does anyone even say that anymore?) email editor that generates templates based upon the output from a Database Query.
The ability to drag and drop various fields from the database query into the email template.
Display of sample email results with the database query.
Web application, preferably not requiring IIS.
Involve as little code as possible for the end-user, but allow basic functionality (i.e. arrays/for loops)
Either comes with it's own email delivery engine, or writes output in a way that I can easily write a Python script to deliver the email.
Support for generic Database Connectors. (I need MSSQL and MySQL)
F/OSS
So ... can anyone suggest a project like this, or some tools that'd be useful for rolling my own?
(My current alternative idea is using something like ERB or Tenjin, having them write the code, but not having live-preview for the editor would suck...)
I think your looking for a reporting tool which is also capable of sending email. Sending a generared report in html or pdf shouldn't be to hard to do as well.
I've used JasperReports in the past for which I think it should fit your needs.
Another good solution is the pentaho reporting tool
You could easily write something on your own.. give them a basic edit control and allow them to use psuedo variables like {customername} {anothercustomerattribute} within the mail body.
On submit either send directly or save as template.
When the template is sent away the script automatically parses stuff like {customername} into the real customers name from the database.
Your own very very simple custom scriptlanguage :)
Everything else like loops and so on would be maintained on serverside. And if you want particular groups of customers to receive the letter, allow the enduser to select from selectboxes or whatever and do the rest on the serverside with pre-defined rules.

Generating an article from an email in mediawiki

I would like to be send an email to an address that mediawiki can pick up and have mediawiki take it and generate a new page from it as a starting point. More complicated stuff like categories can come later.
I have searched around on the web and not found anything obvious.
I have not developed against mediawiki before but am an able and willing developer.
Thanks for any assistance provided.
There is this extension - EmailToWiki
It relies on a POP3 account being available and has been in Beta for a long time, but it may be a good start for what you want to do.
Have a daemon of some sort running on the server that picks up emails from an account (through POP protocol presumably), use the Mediawiki API to generate stub page.
Instead of a daemon, you could just have a cron job of some form.

what language combination should I use to permanently modify a webpage?

I'm trying to make a page with 2 fields (email and feedback) and 1 button. When the user clicks on the button, a table on a page else where is filled in with the data, permanently.
Does anyone have recommendations of how I should do this? I'd like to avoid having a script send me an email, or writing to a database. But if I have to, which ever is easier to configure would be prefered.
Thanks,
Matt
So you want a comments system like you find on most blogs? You'll need to store those comments somewhere, probably in a database. As for how to do it, that would depend entirely on what you already know and what the site is currently written in. You could use PHP and MySql if you already have those skills, or ASP.Net/SQL Server, or if you want to be down with the cool kids you can use Ruby on Rails or Python/Django.
If you post what languages you already have experience in, and/or what the site is written in you might get a more specific answer :-)
There're 2 types of scripts: server side and client side. The client side script (JavaScript) stores info only for particular visitor on his computer and this can't be seen by anybody else.
You need a server side script to save feedback on the server. The language or technology depends on the hosting server you use. Not all hosting services allows server side scripts. You need first to find out what scripting languages and technologies are supported by your hosting provider. Then we can help you more.
ADD:
For an unexperienced persons I recommend to search for hosting services which has most needed functionality. Something like blogs, etc. On such services you could create pages that will have comments and feedback and many more.
While it may seem outdated it's not necessarily a bad design. You can use PHP or Perl (due to it's string parsing capabilities) and simply store the main page on the disk.
Here's your sudo code/design...
You'll need need an html page that looks as follows
<tr><td>email</td><td>comment 1</td></tr>
<tr><td>email 2</td><td>comment 2</td></tr>
<tr><td>email 3</td><td>comment 3</td></tr>
Then you'll need a php script page that will read this html file in and display it.
The php page will also contain code for dealing with a user submitted comment. When a user posts a comment you need to open the html page with the rows in it and append to that file.
You need to be careful with this design however because you may run into write concurrency issues if two people attempt to read the file at the same time. Add code to handle this gracefully accordingly.

is there any such thing as SMTP to FTP gateway?

PROBLEM: I need a way to automatically convert CSV e-mail attachments into HTML using python, perl, ruby, or something else. I routinely get these and it is too tedious to do these by hand.
QUESTION: Is there a service or trick one can use to forward e-mail so that the attachments show up on a file-server, ready for scripting and conversion out of CSV and into HTML? Has anyone done this using cron, FTP or any other well-known system?
In PHP I wrote many cronjobs to handle attachments based on this script: http://www.linuxscope.net/articles/mailAttachmentsPHP.html.
With it I log into the email account, fetch all attachments and do whatever I need to do. And for CSV, you can use many function, such as fgetcsv().
It's not python, perl, nor ruby (it's something else :)), so the answer to your question is: Yes, it's possible.