send database info to email - mysql

I was wondering if sanyone could help me with the following:
I have some info inserted into mysql database on a couple of pages. After this is done I retrieve these info (in a new page) from the database and want to send them via email to various emails including one from the info from database.
I have built the email() function and "SELECT" all the info from the database (have them into some HIDDEN fields).
I am not sure how to go about getting these info sent via email.
I have tried, but all I get is an empty email with no info from database.
Hope I explained my problem and someone can give me clue about this.
Many thanks
Francesco

MySQL does not include a feature for sending email. So you'll need to write additional software to handle the job for you.
One issue to decide, how will the email be requested? -- How will the process be initiated?
You could have your web page (written in PHP or any other language), which shows the information on the screen also send the email. See sending email from php.
A better performing idea is to first queue up your requests for sending emails. That way you won't slow down your web server. Then have a background job process each of the requests, reading the database and sending off the emails. Google for "php background processing" for help or ask more questions on StackOverflow.
Also, remember to check that your email is not being treated as spam.
Re: using the data from the database for sending the email--that's easy, just read the database, then use the information for creating the email's to, cc, subject and other fields.

Related

How to get notified by mail when rows are inserted into table?

I made an online store coded in JSP and tables stored in MysQl. I'm using servlet and classes. I would like to get notify by mail at admin#domain.com when an order is inserted in the database.
Likewise, the customer should receive the order confirmation to the email they entered when they submit the form.
I would like to get feedback on how to do such a task. What's the best practice? I hope to not get back fire with this question because I`m aware there are several answers possible.
Basically, I`m just looking for the easiest and fastest implementation without too much hassle!
The form contains very sensitive and confidential data like address and such. But, since our customers can track their orders on the site, the data should not be sent, for security purposes. Just a message to confirm the reception of their order.
Please guide me in the right direction.
If you are using Hibernate i would recommend you using an entity listener, specially with a #PostPersist callback. You can read about it in Chapter 6. Entity listeners and Callback methods.
The email part can be done using the JavaMail API.
You can check an example of sending an email in Sending an Email using the JavaMail API.
Hope it helps!

Importing e-mails and attachments into a database

I've searched around a little bit and can't seem to find anything super useful on how to do this. I would like to be able to set up an email account which is able to receive emails and parse them into a database which will be useable later. What I would like would be to have a Database which linked the Sender, Subject, and attachment together at minimum, and maybe email the sender with an automated response if the database was successfully updated.
Thanks for any help you can provide in getting me started with this!
If you are mainly storing emails then you probably either want this: http://archiveopteryx.org or this: http://www.dbmail.org/
If you want to send emails with "commands" or "updates" for your database to process then read up on procmail and whatever MIME-parsing library your favourite language supports. Note that MIME can be fiddly, so allow time to understand the problem.

Send email from web browser

This question is hard to explain and can be vague. What I am trying to achieve is something similar to the click of a "reply" button found on Craigslist.
What makes this unique compared to a simple mailto or using an smtp sever is that the user must log in to their email accounts and automatically goes to send email with the send information available or (already given) eg. "joesmith#email.com".
Where do I find information on this? and examples.
Note that I use Visual Studio 2010 language C#
You should be able to accomplish something similar to the Craigslist example by creating links with the following URLs:
https://mail.google.com/mail/?view=cm&fs=1&to=<to_address>&su=<subject>
http://compose.mail.yahoo.com/?to=<to_address>&subject=<subject>
http://mail.live.com/mail/EditMessageLight.aspx?n=&to=<to_address>&subject=<subject>
http://webmail.aol.com/Mail/ComposeMessage.aspx?to=<to_address>&subject=<subject>

Using email to update SQL database

Is it possible to use email to update mysql table?
for example I have someone send email which have today article with the image as an attachment and it have to send to particular email address (eg: abc#something.org) to be able to process data to sql table, other address will not work for updating.
Once it receive, it automatically proceed and update sql from the article it receive.
How is it work?
is there any open source that may help this process
Not by sql, you have to involve some sort of programming language which have a subset of methods to communicate with the database and that can receive and send email.
Take a look at Sendgrid (at http://sendgrid.com): they have a parse API (see http://wiki.sendgrid.com/doku.php?id=parse_api for details) that basically lets you convert an email into an HTTP POST. So if you already have a web page that can update the MySQL database you can just modify it to comply with their spec, set up a sub domain that forwards to Sendgrid and then setup a Sendgrid endpoint that takes any email to that sub domain and posts it to your web page.
It depends on your application. If you're using a framework like Wordpress, there are plenty of plugins available to integrate (e.g. Postie). If you have your own custom application, you may find an open source script to download the new messages, but you'll have to implement your own code to update your database.

html form within mail client

Ok, get this.
I have been assigned to write an html form to be EMAILED to clients so that they can fill it in and submit it FROM THE EMAIL CLIENT! apparently emailing a link to the existing form on our website is not good enough.
I am still trying to get my head around this as it seems almost void of common sense, but anyways, my guess is that I will have no way of validating data, and if actually works, how will the user know? WTF?????
Get this, They will be emailing both a pdf and an html doc to clients, I tried putting my case forward but apparently the marketing pro's say IT IS POSSIBLE AND MUST BE DONE, WORKING BY FRIDAY!
This is not a good idea on many fronts:
Not all email clients will support a form post from HTML
see: http://www.campaignmonitor.com/blog/post/2435/how-forms-perform-in-html-emai/
No clientside validation
What's exactly wrong with a link?
How are you getting data from PDF form submission? You can get expensive form tools from Adobe: http://www.adobe.com/government/forms.html
Some spam / av checkers will dispose of form based emails.
There are only two possiblities: first one the mail client must have a php runtime environment to run the php script locally, also an embedded mail server - which isnt the case for the most of them. Second one is that your mail client acts like a browser and displays the form (which is located still on the internet) in his mail viewing window (which is perhaps possible but i dont know any common mail client doing this).
So you either submit a link to the form or you construct the mail this way, that there're placeholders to be filled and submitted like a normal mail response.
This idea is plainly wrong. You're creating a phishing vector for your company which could expose them to huge legal liability. Just ask them how much money they are going to be putting into the legal defense fund in order to pay out for the lawsuits they are going to lose.
An adobe pdf server is about the only reasonable method for doing this, but that takes lots of cash and work on your network to support a new type of server.
It's generally bad idea. Most email clients only allow limited HTML, with limited CSS and without any JavaScript at all.
See: http://www.sitepoint.com/code-html-email-newsletters/
Many mail clients will not allow submitting any form (at least with standard security settings).