Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread How to send emails and print a data record?
Tue, Aug 25 2015 8:24 AMPermanent Link

kamran

Hi just some basic questions.

Is this functionality easy to get at?

1. How to send an email ?

e.g. Something that takes the parameters
from email address, to email address, subject, email content

Is that easy enough to do in ewb ?

An example would help.

2. How to print a data record ?

e.g. an invoice from data stored in a dbisam file

An example would again help.

Thanks in advance.

best regards

Kamran
Tue, Aug 25 2015 12:19 PMPermanent Link

Raul

Team Elevate Team Elevate

On 8/25/2015 8:24 AM, kamran wrote:
> Is this functionality easy to get at?

It varies.


> 1. How to send an email ?

If you know they have an email client installed (or more specifically
"mail" verb registered in their OS then you could just call that.

Absolute easiest way to use this is to just drop a TLink and set the URL
to something like "mailto:mail@example.org?subject=hello from
ewb&body=this is my email body".


However relying on email client being installed is not always true so
usually you want to create your own web service and do an ajax call (get
or post if you need to include attachment or large amount of data) to it
and have it send email on your behalf.

Alternative is to use one of the many existing cloud based email
services but again you're better off routing it thru your own back end
web Service for security reasons. Even with your own service you need to
think about security so you don't become a spam bot.


> 2. How to print a data record ?
>
> e.g. an invoice from data stored in a dbisam file
>
> An example would again help.

Again depends on your requirements - easiest is to just use the browser
print capability and open a new browser window with properly formatted
date. For additional control you might again want to have a back end web
service that for example generates a PDF that you then open in a new
browser window and can print from there (if you search forums there are
number of people who have done this and have discussed what they did and
components they used).

Raul
Tue, Aug 25 2015 2:56 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

kamran wrote:

<< 1. How to send an email ?

e.g. Something that takes the parameters
from email address, to email address, subject, email content

Is that easy enough to do in ewb ? >>

You'll need to use an EWB Web Server module to do so, or some other back-end application code like PHP, ASP.NET, etc.  The EWB client application really doesn't care - it will just simply send over the parameters using a TServerRequest and the back-end will need to take care of the rest.

See here for more information on creating an EWB Web Server module:

http://www.elevatesoft.com/manual?action=topics&id=ewb2mod&product=rsdelphi&version=XE&section=getting_started

<< An example would help. >>

2.01 includes a PDF module (and PDF client application) example that shows how to serve up PDF files as request responses in an EWB Web Server module.  I'll see about adding one for showing how to send an email.

<< 2. How to print a data record ?

e.g. an invoice from data stored in a dbisam file >>

How do you do so now with Delphi/C++Builder ?  Just take that same code, put it into an EWB Web Server module, and then instead of printing the output, have it export it to PDF/HTML and send it as a response to a request.  If you have a Delphi XE* version with FastReports, it can export to PDF/HTML very easily.

Tim Young
Elevate Software
www.elevatesoft.com
Image