HTTPClient & Simplepost to send emails from our apps


Romeo Ross

Hi David

Thank you for your great product.

Is there s possibility that you can create a sample where the all the input information be sent to a specific email address and not just give an alert saying it was successful.

For someone with your talents I am sure you will be able to assist, I have been trying for days how to do this but for a non-programmer this is a difficult job.

Thank you once again.


DecSoft

Hello Romeo,

Thanks for your kindly words. I certainly think that your issue is related with the ability to send emails from our applications: we simply can't do that from our applications nor from any other Javascript based application: we can't send emails from Javascript, except using a thirdparty online service.

However the server side yes, can send emails, then, what we can do is certainly an HTTP request to some script in our server in order to send the email we wanted. If you are using PHP in the server side, for example, they offers to us the well named "mail" function.

So what we must do is the following:

  • In our application prepare an HTTP POST request to be made with the HttpClient control.
  • The request must contains the recipient email address, the email subject, the email body and more (if needed).
  • In the server side, we deal with the received request and pick the appropiate input: email address, subject, etc.
  • That's all. The server side script, for example, PHP, call to the "mail" function in order to send the email.

In fact I start to work here in a sample for you, but, when I almost finished the PHP script... I just remember that the Calculator application sample already incorporates an script like that for their "Feedback" view. So you can take a look at that sample too.

But, since I almost finished the PHP script... and the application sample can take not too much time (thanks AB!) I want to prepare a sample for you specifically designed to send emails from the application.

So please, upgrade your App Builder copy and take a look at the new "SendEmail" sample.

Then tell me what do you think about Romeo!



DecSoft

Hello again,

I think I forget something... you talking about the "SimplePost" action and the "HttpClient" control. Can we use the "SimplePost" action to send emails instead of the HttpClient control? Yes, of course, and also the "SimpleGet" action.

However, this actions doesn't provide us any feedback about the request, then, probably it's a good idea to use an HttpClient control, like in the "SendEmail" sample, then we get informed if the task is successfully executed or what.



Romeo Ross

David thank you so much for the great sample, it is amazing how fast you respond and help to solve problems.


DecSoft

Hello Romeo,

David thank you so much for the great sample, it is amazing how fast you respond and help to solve problems.

You're welcome! Hope you find it useful!



Romeo Ross

Morning David the sample works perfect and I even managed to add an extra inputbox for a phone number into the sample and then added that extra code into to the PHP file to include it. Is there a way you can add in a drop drop selection as well?

I want to receive the dropdown selection information in the email as well. but don't know how to add that in ,especially in the PHP file.

Please see my sample picture. Thank you very much.


DecSoft

Hello Romeo,

The Select control, as well others controls, store their items in an Array variable. You can take a look at the "Select" and "Select2" app samples. Now supose we have a Select control named "MySelect", then we can get their selected item with a code like the below one:

The variable "[SelectedItem]" stores the selected item text, then, we can add it to the HTTP request in a way like the below one:

If you remember the other fields in the send email request:

... we can access to this field by their "keys/identifiers" in the server side, so, you know we can access to "EmailBody", "EmailSubject" and "EmailAddress" in the server side.

We can add any number of keys/identifiers and values pairs in our request, then, after this:

... we can also access in the server side to the "UserSelection" input, in the same way than all the others: "EmailBody", "EmailSubject", etc.



Romeo Ross

Hi David

Thank you very much...

I follow exactly as above but still cant get right after two days.

The email sends successfully, I get ALL the input info but the selected ''ArrayGetItem'' is no where in email I receive.

Please can I ask you to put in sample and the sendemail.php if you don't mind.

Apologies for all the questions.


DecSoft

Hello Romeo,

I am not now in my PC, but, I will to enhance the "SendEmail" sample tomorrow in order to incorporate a "Select" control. And please, you no need go apologize for anything. Just ask whatever you needed and here we try to help as best as possible.



DecSoft

Hello Romeo,

Please, upgrade your AB copy: the SendEmail sample has been enhanced in order to use also a Select control. I think you get into problems (maybe I am wrong) because before the "EmailBody" input is directly used (after their validation) in the PHP's "mail" function. As you can see in the new SendEmail sample, we conform an email body using the "EmailBody" input and the introduced value from the Select control. Take a look and tell me if you got it!



Romeo Ross

Its works :-) Thank you


DecSoft

Hello Romeo,

Its works :-) Thank you

You're welcome!


Todo el mundo puede leer el foro de soporte de DecSoft para aprender del mismo, sin embargo, sólo los clientes de DecSoft pueden abrir nuevos hilos. Compre una o más licencias de productos de DecSoft y obtendrá este y otros beneficios.

Este sitio utiliza "cookies" útiles para almacenar sus preferencias.

Bien. Ocultar esta nota. Obtener más información.