How to send an email to multiple email addresses with the send mediator WSO2 - wso2

I have created a file transfer service that sends files from one locations to another and when those files successfully transfer, it sends out an email to notify the receiver that the files are in their directory.
I have it currently working with one email, however I need the email notification to be sent to multiple email addresses.
I was using the address endpoint to achieve the signal email being sent out. I have implemented a couple of ways to send an email to multiple endpoints but none of them worked.
I have tried to implement the recipient list endpoint however after doing some research it seems that it currently does not work on integration studio and throws an error every time i add it to the design.
I can not use the loadbalance endpoint or the failover endpoint as it sends an email to the first endpoint only and I have tried to make a copy of the default MailTo sender configuration in the <EI_HOME>/conf/axis2/axis2.xml file and change the transport sender name. For example, add mailtoWSO2 as the name.
<transportSender name="mailtoWSO2" class="org.apache.axis2.transport.mail.MailTransportSender">
And I added the endpoint to the syntax however in which ever way I added it, it automatically gets removed.
If there is a way around this, any assistance is greatly appreciated.

If you have proper configuration for MailTransportSender, you use comma to separate recipients. For you case it should be something like below:
<send>
<endpoint>
<address uri="mailtoWSO2:one#mail.com,second#mail.com" />
</endpoint>
</send>

Related

How correctly make sequence for WSO2 API? It's breaking email send

I create simple api with URI-template
/my_context/{param1}?b={param2}
I created simple sequence for sending email message to endpoint with address
mailto:user#gmail.com
I opened link
/api/my_context/123?b=222
And found in log messages:
Send TO: user#gmail.com/my_context/123?b=222
Incorrect Address.
Why WSO2 ESB append uri to email address?
Removing REST_URL_POSTFIX property like this will change that behavior.
<property name="REST_URL_POSTFIX" action="remove" scope="axis2"/>

Get users IP address that triggers a call from WSO2 API Manager

Is possible to get the users IP that triggered the API call on WSO2 API Manager and pass it on to the call?
Any help how to do this please
You can add following property before calling endpoint (before send mediator) to your api to get the ip of user
<property name="client_ip_address"
expression="get-property('axis2','REMOTE_ADDR')"
scope="transport"
type="STRING"/>
Since the scope is set to transport the client_ip_address is set as a header of outgoing message. You will be able to see something similar to below log when the wire is enabled.
[2016-01-21 15:44:10,187] DEBUG - wire << "client_ip_address: 172.22.99.122[\r][\n]"
Hope this will help you.

Sending Text Messages (SMS) With ColdFusion And CFMail

I'm building a web application that needs to send notifications by SMS. As ColdFusion itself provides an SMS Service, can I use the same for sending SMS without using any 3rd party SMS Gateway Service like Clickatell?
I have found some information at Ben Nadel's website but it is not working,
Sending Text Messages (SMS) With ColdFusion And CFMail
I have tried the following code,
<cfmail to="9567102323#ideacellular.net" from="9567102323" subject="New Message" type="text">
<cfmailpart type="text/plain">Hello huan, this is a test message</cfmailpart>
</cfmail>
As guessed by Miguel in the comments, your code will not give the desired result because the from attribute of your cfmail tag is not a valid email address. Your ColdFusion code will execute without error but the mail will not be sent. The mail file will appear in the Undelivr folder of a path resembling this: yourlocalsystem\JRun4\servers\cfusion\cfusion-ear\cfusion-war\WEB-INF\cfusion\Mail.
For the code in your question, add "#ideacellular.net" to the from attribute of your cfmail tag. From here, I'm a little uncertain. If that mail goes to the Undelivr folder it might have something to do with your mail server only being able to send mail from certain domains. I have vague recollections of stuff like that happening to me.
You can't send SMS direct from ColdFusion, does not have this capability, just like ColdFusion does not have a built-in mail server. cfmail tag makes it easy to communicate with a mail server, but it does not send emails itself.
Regarding SMS, ColdFusion makes it easy to work with SMS gateways, look at CF docs for "SMS Event Gateway" and sendGatewayMessage().

WS02 API Manager malformed request to endpoint URL

We have our API being managed by WS02 API manager, but there seems to be some issue with the way it constructs the outgoing request into the configured endpoint URL. We see this sort of error from our endpoint when we make a request to the API manager:
Cannot bind to address "http://<HOST>:<PORT>http://<HOST>:<PORT>/<RESOURCE>
The URL is clearly incorrect as it is prepending the host part of the URL twice. We've put a debugging proxy in between the API manager and our endpoint and it shows the outgoing request looks like this:
GET http://<HOST>:<PORT>/<RESOURCE> HTTP/1.1
...
Host: <HOST>:<PORT>
It isn't normal for the host to be included in the first line; that should come from the "Host" header. But as it is, it makes sense we are getting the above error. Note, when we proxy this through something like Nginx, it works fine, but the server we are actually using for our endpoint doesn't like it. I'm guessing Nginx has been written in such a way so that it can resolve this kind of (technically incorrect) request.
We are adding propery 'POST_TO_URI' to our synapse API configuration in order to make the outgoing URL a complete URL [1]. This is useful when sending the messages through a proxy server. You can remove that property by modifying your API in AM_HOME/repository/deployment/server/synapse-configs/default/api/ directory. Remove the below property in your relevant APIs which sending requests to such backend servers.
<property name="POST_TO_URI" value="true" scope="axis2"/>
[1]https://docs.wso2.org/display/ESB460/HTTP+Transport+Properties

Custom Uri or endpoint on WSO2

We have just installed our WSO2 ESB, and we are trying to create some proxies services with customs endpoints.
The default endoint format is:
http://{host}:{port}/services/{Proxy Service Name}
I'd like to have something like:
http://{host}:{port}/services/utilities/{Proxy Service Name}
http://{host}:{port}/services/public/{Proxy Service Name}
I followed this tutorial:
http://wso2.org/library/knowledge-base/2011/01/custom-urls-wso2-esb-proxy-services
but we have a problem, when I send a request to my custom endpoint, I have no answer.
suggestions?
I assume that you were able to properly create a custom endpoint and "I have no answer" means you didn't get any response. If it is the case following are the possible reasons for that,
Proxy service endpoint didn't receive the request
Proxy service didn't configured properly to response back
So test whether the 1 is the reason you can simply put a log mediator with following configuration in inSequence,
<log level="full"/>
then if the proxy service received a message it will log it in console. If that works could you please post your proxy service configuration to check whether it is properly defined.
Well, it seems that we've found a solution, I'm going to resume the full solution.
As the tutorial indicates, to costumize your proxy service endpoint, you have to add the following handler on the axis2.xml configuration:
<handler name="CustomURIBasedDispatcher" class="org.apache.synapse.core.axis2.CustomURIBasedDispatcher"/>
Then, you can customize your endpoint on the design view or on the source view, I've choosen the source view, adding this parameter:
<parameter name="ServiceURI">/services/intern</parameter>
The custom endpoint is autogenerated as:
http://{host}:{port}/services/intern.myWebservice
But I has not worked for me. If I send a request to the custom endpoint, I have no response.
I've solved the problem, adding to the "ServiceURI" parameter the name of the service:
<parameter name="ServiceURI">/services/intern/myWebService</parameter>
then you have to send the request to the following endpoint:
http://{host}:{port}/services/intern/myWebService
So now you have a custom endpoint for every proxy service.
Thanks Malith for your help.