Blank email is sent with Send Email connector in Mule 4 - mulesoft

I am using Send Email connector (SMTP configuration) to send email to gmail. It is observed that sometimes email is sent with blank body. Though in the mule log I am able to see that the email body is constructed correctly just before the Send Email connector, but the email sent is having blank body.
Even though this issue is occurring very rarely but would like to know how we can avoid such situation and is there way to handle this situation? Also, what could cause this issue?
Thanks in advance

There could be two (and more) possibilities:
Your payload being json is not getting read correctly, try payload.^raw when working with email body json. Had to do this when sending a multipart/form-data containing json content for email service
Having said this is a rare scenario it could be possible that your error flow is itself throwing an error ( either while building the body / while calling email end-point) which throws off the body and in the 2nd flow error type being changed without a body the email is sent across? Check your flows make sure http calls are surrounded with Untill-successful scope..
With more info, we could dive deep. What do you think ?

Related

How to let users know flow has completed?

I have a flow setup in logicapps that starts with a http response, the user enters data in an excel sheet and clicks a cell/hyperlink which kicks things off. They receive a response saying the flow has started and was wondering how I could update the response once the flow has completed (either successfully or if it has failed). I’ve only created basic flows before and when googling I’m not too sure what I should be searching for but cant find any examples of what I’m trying to achieve, any ideas?
Here is one of the workarounds that might work. You need to add the response at the end of the flow. Consider my logic app as a sample. If my "Var" is yes then in response it sends Success as a response to my postman and if it is other than yes it sends Failed. Here is my logic app for your reference:-
Result:
In postman
In your case, you can use some properties to define if they got classes or not and then use the same condition connector to send the response.

Azure Logic App: How to keep embedded image in email body when forwarding on?

I am setting up a bulk emailing solution combining Logic Apps and SendGrid.
User sends email to a mailbox with attachment of required recipients > Logic App reads email > LA resends 'Body' via SendGrid for each recipient.
This works fine with a plain email. However, when an image is embedded within the body Outlook uses Content-IDs.
Currently the body of the email just says a broken image symbol.
How can the images be kept for the re-sending on?
enter image description here
If you want to implement it directly, it could be done. Because if you try to get the mail body you will find it's like below picture.
The body is escaped mail content and the image content is the contentBytes under attachments it's a base64 code.
So if you want to send a image from another mail you have to get the base64 code embed it to your mail. I use the outlook trigger to test it and send with sendgrid, the content will be like this code.
This is test email <br>\n<img src=\"data:image/jpeg;base64,#{triggerBody()['attachments'][0]['contentBytes']}\">
I test this way could send the image, and it could be seen in the mail. If this is not what you want please let know.

Sending immediate response and detailed message in DialogFlow

I have a requirement of sending two messages from my chatbot. The first message will be send immediately as a response like "please wait for a moment" and the second one will be sending after an API call.
I'm using Dialogflow with Facebook messenger. Is it possible in Dialogflow send an immediate message and later send a detailed one?
No, you can't send two responses asynchronously. You could show two simple responses but those would be sent at the same time.
app.ask(app.buildRichResponse()
.addSimpleResponse('This is the first')
.addSimpleResponse('and this is the second')
);
I don't know a way to give two responses to the user at different times, but as an alternative, you can give a default response to the user along with the fulfillment response in case something goes wrong on the server side like
Bot: Something went wrong.. please check your internet connection or try again after some time.

"No Access Control Allow Origin" in AngularJS

I am trying to develop a website that reads a JSON response from a certain endpoint and post it after certain processing to the page.
I am using $http.get(url) (AngularJS)
However I am facing problems getting the response.
I have tried to use other URLs and it worked then the cause of the problem probably is not the code.
The Error is: "No Access Control Allow Origin header is present on the requested resource".
Other responses suggested something related to CORS and privacy issues ; but when i type the URL directly in my browser it gives a JSON response directly. (So basically there is no privacy issues in the server side right?)
My question is what should I do ? Is there another way to get the content of the page pointed by the url (i am sure that it will only contains the JSON response)
Thanks in Advance
I came across this question:
1. If we substitute the URL in the address bar, it is similar to receiving data from the server of this site
In order to send requests to other servers need to use JSONP HTTPS for secure channel
Sending data can be carried out, but with the replies received will be a problem in the form JSON
Please send to the server if use PHP, then use CURL
JS->Our server->Server api->Our server->JS

Force.com callout: Is there a way to get the full response from the target server

When calling a web service from Force.com, I am getting:
System.CalloutException: Web service callout failed: Unexpected
element. Parser was expecting element
'http://schemas.xmlsoap.org/soap/envelope/:Envelope' but found ':HTML'
The network guys at the other end has asked to see the full response that Salesforce is getting from their server.
Is there a way to achieve that? I have tried running with debug level 'Finest' from execute anonymous, but that yields the same little message with no further detail.
The message you are getting is because an error is generated as Saleforce is trying to parse the response is and it isn't logged unfortunately.
The parsing error is happening because instead of a SOAP message response you are getting an HTML page. This usually happens when you are accessing a service that is protected behind a firewall. Which means you may be able to see the service when browsing on your computer but remember that Salesforce is outside of your firewall and thus any communication by Salesforce to your service will be blocked.
Couple of ways to address this but this wiki topic from Salesforce best covers the options:
http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_om_outboundmessaging_security.htm
The above is specific to outbound messaging but essentially the technology issues are the same.
Don't forget that Apex includes an HttpRequest Class that works as a lower layer than the SOAP APIs. You should be able to write up a test method that sends a hard-coded XML request to the server and dumps the HttpResponse so you can see it.
Adding my own best answer, based on some internet research:
You can use an external tool like Runscope as a webservice proxy to automatically forward requests and pass through responses and view the XML SOAP messages. This is not a native solution on SFDC but it does do the job.
https://www.runscope.com/
The issue is that Force.com is trying to parse a SOAP response that's actually just HTML. This happens sometimes when an error occurred server-side and the response is meant for a browser to display, rather than sending back an exception report via a properly formatted SOAP response.
If they can't figure out why they are not sending back a consumable SOAP response, then you can try using other tools (outside of Force.com) to make the same webservice call from your browser and then see what the HTML actually says on return.

Resources