Sending Dialog Contents via Email
There are times when the output of a dialog should not go directly to a database. You may want to email the entry, for example. Here is how you would do that, assuming that once again you are starting with our Simple Dialog example.
In the Xbasic functions section of your dialog, insert this function:
FUNCTION sendEmail AS L (address AS C, subject as C, body AS C ) debug(1) dim pm as P dim ps as P sendEmail= .F. IF (email_smtp_open(ps, "smtp.myserver.com", 25, "[email protected]","password")) pm.to = address pm.from = "myserver.com" pm.from_alias = "My Email Alias" pm.subject = subject pm.message = body sendEmail = email_smtp_send(pm, ps) END IF email_smtp_close(ps) END FUNCTION
You will need to edit the function for your server, which is why we have inserted the debug statement for you. In the afterDialogValidate event, insert the following code:
You will obviously have to edit the address to be the intended, valid email.