WebWrapper is a GeneXus data type that allows to encapsulate Web objects execution (the generated HTML code), and process it as desired. In particular, you can send a Web Panel object via e-mail using this feature.
One way of sending a Web Panel via e-mail from a GeneXus object is by defining a WebWrapper type variable.
The main idea is to capture the contents of the Web Panel (its HTML code) and send it via e-mail. Thus, it must be noted that the mail client receiving the e-mail must have the capacity to interpret the HTML language.
Any event produced in the Web Panel making a post to the server (e.g.: clicking on a button, releasing a procedure, etc.) will cause the Web Panel to be opened in the browser, in the address specified in the BaseUrl property.
There are two ways of including images in the webwrapper:
- Including the images in the Web Panel as an absolute URL. The disadvantage of this option is that the user must be online the moment he is reading the mail. By adding the image as external, you can specify an absolute reference to it. See
- Including relative images in the Web Panel and sending them as an attachment to the e-mail.
In this case, the image route must not include directories (i.e. /imagines/logo.jpg); it only has to make a direct reference to it (i.e. logo.jpg).
&DirTo.Address = 'email@example.com'
&DirTo.Name = 'Jhon Smith'
&mailmsg.Subject = 'GeneXus News'
&SMTPSession.Host = &host
&Sender.Address = 'GeneXus'
&Sender.Name = 'GeneXus'
&SMTPSession.Sender = &Sender
&RetCode = &SMTPSession.Login()
&Wrap.Object = Create(SearchStudents)
&infoContent = &Wrap.GetResponse()
&MailMsg.HTMLText = &infoContent
EndEvent // SendMail