Store emails in MySql tables

In our application, written in VFP9, we would like to include a routine for store, in MySql tables, incoming and / or sent emails ( and then another routine to open these emails ).

Is that possible?

Translate from portuguese:

"Em nosso aplicativo, escrito em VFP9, gostaríamos de incluir uma rotina para armazenar, em tabelas MySql, emails recebidos e/ou enviados ( e, depois, outra rotina para abrir esses emails ).

Isto é possível? "
Emilio MorimotoProgramadorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
Of course that is possible but why do you wish to reinvent the wheel?

I mean there are software to store emails and contents and they have quite a wide range of utilities to go with that.

You can use CDONTS to send emails. It needs to be configured on a server and FoxPro can communicate with it quite well.

http://fox.wikis.com/wc.dll?Wiki~CdoEmail

http://support.microsoft.com/kb/186204
http://www.w3schools.com/asp/asp_send_email.asp
0
Emilio MorimotoProgramadorAuthor Commented:
Grateful for the return.
I think that I could not explain the purpose of routine. I do not intend to send or receive mail through VFP. I wish I could choose some incoming and / or sent emails and store them in the database, linking them to customers folders.
For example, each order would have associated with it the confirmation email. Currently I print and keep it in pdf format. It would be nice to store the email itself.

Translate from portuguese:

"Grato pelo retorno.
Acho que não conseguí explicar o objetivo da rotina. Não pretendo enviar ou receber emails pelo VFP. Eu gostaria de poder escolher alguns emails recebidos e/ou enviados e guardá-los no banco de dados, associando-os a pastas de clientes.
Por exemplo, cada pedido teria a ele associado o email de confirmação. Atualmente eu imprimo e guardo no formato pdf. Seria ótimo poder armazenar o email em sí."
0
Fundamentals of JavaScript

Learn the fundamentals of the popular programming language JavaScript so that you can explore the realm of web development.

CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
You can store the EML or MSG as a file in a fixed folder and store its name in the database. You will launch the EML or MSG file by using ShellExecute:

= ExecuteShell("d:\emailfolders\email.msg")

FUNCTION ExecuteShell
LPARAMETERS cFile, cOperation, cDefaultDirectory, cParameters
LOCAL nHwnd, cParameters, cDefaultDirectory, nShowWindow
DECLARE INTEGER ShellExecute IN shell32.dll AS ShellExecute;
      INTEGER nHwnd,;
      STRING @cOperation,;
      STRING @cFile,;
      STRING @cParameters,;
      STRING @cDefaultDirectory,;
      INTEGER nShowWindow
nHwnd = 0
cOperation = IIF(EMPTY(cOperation),'open',cOperation)
cParameters = IIF(EMPTY(cParameters),NULL,cParameters)
cDefaultDirectory = IIF(EMPTY(cDefaultDirectory),'',cDefaultDirectory)
nShowWindow = 1
= ShellExecute(nHwnd, @cOperation, @cFile, @cParameters, @cDefaultDirectory, nShowWindow)
CLEAR DLLS
0
jrbbldrCommented:
I wish I could choose some incoming and / or sent emails and store them in the database

Do you mean the text from the body of the email?

Or do you mean a fully-pathed filename pointing to where the EML or MSG file (or the PDF file copy) is stored separately on your disk?

Precisely what information from the email do you want to store into the database data table?

Good Luck
0
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
You can save the email from Outlook or whatever software you use as a file. In the database, you point to that file. Of course it would be ideal to organize the emails in a folder.

In this kind of request, you can't rely on automation. You need to manually do this.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Emilio MorimotoProgramadorAuthor Commented:
Once solved, the question remains: why did not I think of that before?
The solution was obvious, and I could not see.

Thank you.

Translate from portuguese:

"Uma vez solucionado, fica a pergunta: porque eu não pensei nisso antes?
A solução estava na cara, e eu não conseguia enxergar.

Muito obrigado."
0
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
Well, we all tried many solutions and for different projects there are different solutions.

Today it is hard to communicate with Outlook. Before we could do a search of emails and have Outlook open one of them. If you do that, it might become unstable. Office 5/95/97/XP/2003 worked great in automation. The latest versions crash a lot except for Excel.
0
Olaf DoschkeSoftware DeveloperCommented:
You can actually also automate the saveas method to save an outlook mail as msg file.

#Define olMSG 3
#Define olFolderInBox 6

oOutlook = CreateObject("outlook.application")
oMapi = oOutlook.GetNamespace('MAPI')
oMapi.Logon('accountname','password')
oFolder = oMapi.GetDefaultFolder(olFolderInBox)
oItem = oFolder.Items(1)
oItem.SaveAs('c:\temp\test1.msg',olMSG)

Open in new window


You can easily go from newest items to older ones by starting with Items.Count, instead of Items(1). a unique ID of each item is in it's oItem.EntryID property, so you can also see, which Items you already have exported, if you store that in your database. You can act on mail subject or body content or whatever.

You can also just store the EntryID and revisit that mail automagically inside Oulook via
oItem = oMapi.GetItemFromID(entryid stored into and read back from mySQL)
oItem.Display()

Open in new window


Of course that only works on the same client, having that outlook account open, but you can of course store a pst on a share and thereby allow access to many users, if the outlook account is some specifically for order mails.

Bye, Olaf.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
FoxPro

From novice to tech pro — start learning today.