Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 600
  • Last Modified:

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? "
0
etm_wkl
Asked:
etm_wkl
1 Solution
 
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
 
etm_wklAuthor 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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
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
 
etm_wklAuthor 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now