I want to send an email to the user after he/she sign's up in my hybrid application (based on IBM Worklight 6.0).
I want to pass the parameters (email ID) of the user to a PHP file hosted. I tried directly to send a mail in the URL as Follows, and this works:
http://www.xxxyyyzzz.comli.com/email.php?a=someEmailAddress@someEmailHost.com
How to do the same via a Worklight adapter?
ADAPTER.XML
<wl:adapter name="sendmail"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">
<displayName>sendmail</displayName>
<description>sendmail</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>xxxyyy.comli.com</domain>
<port>80</port>
<sslCertificateAlias></sslCertificateAlias>
<sslCertificatePassword></sslCertificatePassword>
-->
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>
<procedure name="getStories"/>
<procedure name="getStoriesFiltered"/>
</wl:adapter>
ADAPTER IMP.JS
function getStories(interest) {
path = getPath(interest);
var input = {
method : 'get',
returnedContentType : 'html',
path : '/email.php?a='
};
return WL.Server.invokeHttp(input);
}
Where is the parameter? You are not passing it to the adapter procedure AFAICT.
Try the below (I did not test it end-to-end, as I don't have a server with a PHP script listening to requests).
HTML
JavaScript
myAdapter.xml
myAdapter-impl.js
See related questions: