How to Send Mail in Salesforce with Custom Code? - salesforce

I have developed an apex class to send email using Exchange Web Services (only method allowed by my company). I have created a test flow to call the apex class and it works. Now i would like to send email through salesforce gui connecting the Send button to my apex class or calling my class when the send event is detected. is it possible? do you have any suggestions?

Related

How to call internal APEX methods provided by B2B Commerce for Visualforce using REST request

Our team has a web application developed on top of B2B Commerce for Visualforce, there is a button on Product page, Add to Cart, it will call an Apex remote action method using Javascript when clicking on the button, I checked the network traffic in DevTools, found the following XHR request
the above XHR request should be made with the similar code
CCRZ.CloudCrazeView.addItem(event), there is the doc for the class, https://developer.salesforce.com/docs/atlas.en-us.b2b_commerce_dev_guide.meta/b2b_commerce_dev_guide/ccrz_CloudCrazeView.htm
does it have a REST API for the method in the picture? if yes any documentation or sources for it, so that I can call the method using HTTP REST requests, I mean calling it with curl, python or java remotely instead of Javascript.
the APEX class is ccrz.cc_RemoteActionController and the method is addItem, I know B2B Commerce provides a collection of REST API, REST API Endpoints for B2B Commerce for Visualforce, but this page doesn't include the method.
It's 2 different annotations and developer might have not used both. For Javascript usage it's #AuraEnabled and for being exposed as REST webservice it's #RestResource annotation on whole class + possibly #HttpPost on the method itself.
The problem is that in given class you can have only 1 of each HTTP "verbs" so if the class supports say 3 different buttons, they all would be accepting data as POST - problem. (in a pinch that dev could have done 1 master method inspecting the service url used, the input params and dispatching to right method for processing but it's bit meh...)
But. You should be able to patch that. Inspect cc_RemoteActionController in setup -> apex classes to confirm the method signature (it should be marked global meaning you can call it from apex too).
Create your own class that will act as REST wrapper
#RestResource(urlMapping='/HiStackoverflow/*')
global with sharing class HiStackoverflow{
#HttpPost
global static void addItem(Event e) {
ccrz.cc_RemoteActionController.addItem(e);
}
}

azure logic app not able to retrieve who is the approver after approving the mail(UserEmailAddress- showing Null)

I have created a flow using logic apps where once the owner approves the mail I need to know who approved that mail. While using normal my account I am able to retrieve the user who approved the mail but while using the service account am not able to retrieve the values. All the values its showing as null while using the service account.
How do I get the --> email address <-- of the user that selects 'Approve' or 'Reject' buttons in the email? If an email is forwarded to another person I would like to know who (email address) clicked approve or reject.
After reproducing from my end, I observed that when the mail is viewed in HTML format this doesn't work and also while forwarding the mail, but this works when the response is sent through the adaptive cards and not the HTML message that are received during the Send email with options action. One way that this can work is when you use only the adaptive cards that are send as the request.
RESULTS:
and when you use HTML responses then below is something how you'll be receiving the response.
You can also try Creating your own actionable messages for Flow Approvals by StefanS365 where in you add provider in Actionable Email Developer Dashboard and request the approvals.

Is it possible to send me a Discord private message when an user confirm a form sending in my website?

I would like to be able to get Discord private message when an user wants to send me a message through my personal website. There is a form inside my website, how can I do this on the onClick button "Send" ?
Look into WebSockets. SocketIO has the most support and documentation however for this simple task you can get away with implementing this using the ws package in nodejs.
Make sure the Discord Bot is the Server & the frontend is the Client.
https://www.npmjs.com/package/ws
https://socket.io/docs/v4/server-api/

how to send SMS from a cakephp application and display a message if successful?

I am building an application in cakephp where I need to send an sms to a newly registered user. I can send sms by using redirect function but then it doesn't get automatically revert back to my webpage.
Maybe you can take a look at this plugin:
https://github.com/fotografde/cakephp-sms

How can my appengine app send mail using the senderid of domain that installed the app

Say I have an appengine app called foo at foo.appspot.com and my email i.e. adminfoo(at)gmail.com is it's adminstrator.
Now, I want to sell this service to blah.com. blah.com has a google app account and 'adds' the foo application and sets the url http://foo.blah.com to point to it.
Now, using the new namespace manager, I carve out separate data for blah.com but when blah.com wants to send out email currently the only way it is possible is either
sender is admin i.e. adminfoo (at) gmail.com
or foo.appspot.com has to add someone(#)blah.com as a developer
Is there any other way? What happens if one has 1,000's of customers ?
Also, the docs state that the email sender can be 'the currently logged in user'. So, if someone(at)blah.com were to 'login' using the google login and 'stay logged in to the app' than can the app send email on behalf of someone(at)blah.com with someone(at)blah.com being the sender?
The other way is that your app can send email as anything#appid.appspotmail.com, where 'appid' is its App ID. As you say, you can also send email as the logged in user - but only on requests made by that user - so sending mail as them from the Task Queue is out.
You might want to look into an 3rd party E-Mail provider. We use http://postmarkapp.com/ for our AppEngine projets (via huTools.postmark) and we love it.

Resources