Ask Reuben

composeMail

What is the composeMail front-call? 

Why does user have to add attachments manually when using the composeMail front-call?

The composeMail front-call started off when Genero Mobile was introduced as a mobile only front-call.  It could be used by Genero Mobile developers to invoke the mobile devices default mail application and create a new mail populated with details such as To, Subject, Body etc

In GBC 4.01.22, an equivalent composeMail front-call was added to the standard front-call library for use with the Universal Rendering interface that utilised the mailto URI scheme.

How both front-call worked was that it would launch the default email application on the front-end and create a new e-mail with To, Subject, Body etc populated by arguments to the front-call.  The user can then modify the mail as appropriate before clicking Send.

There was a subtle difference between the two, the mobile front-call API allowed you to specify attachments whilst the standard front-call that used the  mailto protocol did not allow you to specify attachments.  When the mailto protocol was being used, the user has to manually attach required emails to the email.  This is generally seen as being more secure.  See stack overflow articles such as this where developers have been looking to specify attachments in the mailto protocol.

With the efforts to use javascript where possible for all front-ends, we have standardised on the use of the mailto URL for all front-ends and if you dig inside the GBC source code you will see that the mobile composeMail front-call and the standard front-call both now use the mailto protocol.  (Using GBC Project sources, search in src/js/base/services/frontcall/standard.js and src/js/base/services/frontcall/mobile.js to see this.)

There are other techniques to create and send emails in Genero, have a read of an earlier Ask-Reuben article to see these, paying close attention to wether they are server side or client side.  The composeMail front-call is client side which is why it can’t be sent automatically and comes from your e-mail address rather than a non personal email.