Assuming you have this button on a related list/list view, you can use the {!GETRECORDIDS} javascript function to get the list/array of id of the selected records. You can then send this array to your apex class and then query the email field to get the email. YOu can do something like this:
{!REQUIRESCRIPT("/soap/ajax/28.0/connection.js")}
{!REQUIRESCRIPT("/soap/ajax/28.0/apex.js")}
var recordIdArray = {!GETRECORDIDS($ObjectType.Contact)};
console.log('the record Ids are' + recordIdArray);
var retStr = sforce.apex.execute("outbound_Emails", "SendEmailNotification",{conId: recordIdArray});
global class outbound_Emails{
webservice static void SendEmailNotification (list<id> conId){
list<contact> conList = [SELECT name,email FROM contact WHERE id IN : conId];
system.debug('the selected contacts are ' + conList);
//you can iterate over this list to get the email and send the mail
}
}
So here is my two cents
Note Per comments this does not seem to completely answer the question as OP is looking to keep classic look while providing a look that also appears well under Lightning using a single solution.
For VF components that you want to style as SLDS without having to modify the controller you need to de-componetize them. Adding styles after the DOM has been rendered as pointed out above is not great because it relies on implementation level details you have no control over. Not to mention it is just hacky...
Also, VF components just do a lot of the work for us. Unfortunately, with SLDS we are again going to need to do much of the HTML work ourselves but it is not really that bad.
Using a template approach like mentioned What is suggested approach to transfer VF pages to be lightning ready
So the idea for the code you posted would be to:
- Pageblocktable becomes an HTML table
- Use an apex repeat to build the table rows using the controller variable
- Use an input/output field with the appropriate slds styleclass in each table row
You can maintain controller and page functionality while doing this.
Bottom line is you will need to break these compound tags into HTML elements. Simple tags like input field can be used as is with the appropriate styleclass and surrounding HTML elements thus allowing you to keep built in functionality
Original Markup
<apex:page standardController="Contact" recordSetVar="cs">
<div class="slds cv">
<apex:form>
<apex:sectionHeader title="{!$ObjectType.Contact.labelPlural}" subtitle="All"/>
<apex:pageMessages />
<apex:pageBlock title="{!$ObjectType.Contact.labelPlural}">
<apex:pageBlockTable value="{!cs}" var="c">
<apex:column value="{!c.FirstName}"/>
<apex:column value="{!c.LastName}"/>
<apex:column value="{!c.Birthdate}"/>
<apex:column value="{!c.CreatedDate}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</div>
</apex:page>
Output
SLDS Pageblock / Pageblocktable Markup
A bit more markup but the way it is done ensures that it continues working and does not rely on the "implementation level details" of the old VF components
<apex:page id="dummySLDSPage" standardController="Contact" recordSetVar="cs" showHeader="false"
standardStylesheets="false" applyHtmlTag="false" applyBodyTag="false" docType="html-5.0">
<head>
<apex:stylesheet
value="{!URLFOR($Resource.SLDS, 'assets/styles/salesforce-lightning-design-system-vf.min.css')}"/>
</head>
<div class="SLDS">
<body>
<apex:form>
<apex:pageMessages/>
<!-- Replaces the Standard Pageblock Table Header-->
<div class="slds-page-header" role="banner" xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<div class="slds-grid">
<div class="slds-col">
<div class="slds-media slds-no-space slds-grow">
<div class="slds-media__figure">
<svg aria-hidden="true" class="slds-icon slds-icon-standard-contact">
<use xlink:href="{!URLFOR($Resource.AppFrontier_Assets, '/assets/icons/standard-sprite/svg/symbols.svg#contact')}"></use>
</svg>
</div>
<div class="slds-media__body">
<p class="slds-text-title--caps slds-line-height--reset">{!$ObjectType.Contact.labelPlural}</p>
<p class="slds-page-header__title slds-truncate"
title="ALL">ALL</p>
</div>
</div>
</div>
</div>
</div>
<!-- Replaces the Pageblocktable Table -->
<table class="slds-table slds-table--bordered slds-table--cell-buffer">
<!-- Use a caption if desired
<caption class="slds-text-heading--label slds-p-bottom--medium">{!$ObjectType.Contact.labelPlural}</caption>
-->
<thead>
<tr class="slds-text-title--caps">
<th scope="col">
<div class="slds-truncate" title="{!$ObjectType.Contact.fields.FirstName.Label}">
{!$ObjectType.Contact.fields.FirstName.Label}
</div>
</th>
<th scope="col">
<div class="slds-truncate" title="{!$ObjectType.Contact.fields.LastName.Label}">
{!$ObjectType.Contact.fields.LastName.Label}
</div>
</th>
<th scope="col">
<div class="slds-truncate" title="{!$ObjectType.Contact.fields.BirthDate.Label}">
{!$ObjectType.Contact.fields.BirthDate.Label}
</div>
</th>
<th scope="col">
<div class="slds-truncate" title="{!$ObjectType.Contact.fields.CreatedDate.Label}">
{!$ObjectType.Contact.fields.CreatedDate.Label}
</div>
</th>
</tr>
</thead>
<tbody>
<apex:repeat value="{!cs}" var="c"> <!-- Build the columns -->
<tr>
<th scope="row" data-label="{!$ObjectType.Contact.fields.FirstName.Label}">
<div class="slds-truncate" title="{!c.FirstName}">
<apex:outputField value="{!c.FirstName}"/> <!-- Standard VF component -->
</div>
</th>
<td data-label="{!c.LastName}">
<div class="slds-truncate"
title="{!c.LastName}">
<apex:outputField value="{!c.LastName}"/>
</div>
</td>
<td data-label="{!c.Birthdate}">
<div class="slds-truncate"
title="{!c.Birthdate}">
<apex:outputField value="{!c.Birthdate}"/>
</div>
</td>
<td data-label="{!c.CreatedDate}">
<div class="slds-truncate"
title="{!c.CreatedDate}">
<apex:outputField value="{!c.CreatedDate}"/>
</div>
</td>
</tr>
</apex:repeat>
</tbody>
</table>
</apex:form>
</body>
</div>
</apex:page>
Output
The general idea would apply to the rest of the items you would like to convert. You could even go so far as spending a bit of time to make VF Components that are done in SLDS styling and used to replace existing VF components. If the project is large this could be beneficial as it would save a lot of time.
Maybe I should put a package of reusable replacement SLDS components for VF components together...hmm...There is already a library out there but it had way too much overhead and really hacked the styling.
Some additional resources:
VF SLDS Checkbox: SLDS and inputField checkbox
VF SLDS Lookup with autocomplete: Lookup Field Dual Keyboard Focus (Answered with working Autocomplete lookup component and JS example for VF/SLDS)
VF SLDS Select Checkboxes: Convert apex:selectCheckboxes into slds style
VF Page Messages Replacement: How to convert a Visualforce apex:pageMessages to be lightning style
Best Answer
You could use Visualforce with standard list controller. Using a standard list controller is very similar to using a standard controller. First you set the standardController attribute on the component, then you set the recordSetVar attribute on the same component.
For example, to associate a page with the standard list controller for accounts, use the following markup:
The recordSetVar attribute not only indicates that the page uses a list controller, it sets the variable name of the record collection. This variable can be used to access data in the record collection.
Below is stack exchange link for one use case where im selecting a list of records on the list view and iterating on them to export into excel in the below example.
Note: even though the below link is for a different issue I just wanted to show you the use case. Issues with List API in Read Only mode VF page
Im my above example value="{!selected}" is the equivalent for GETRECORDIDS.
Also to get the selected record id's in apex I'm pointing here for another SFSE link Creating a custom list-view button that handles multi-record selection
I tested my vf code in lightning and it had a weird bug before summer 18 where the the selected records were inconsistent but they fixed it with summer 18 and everything looks good now. I will update here with the link when I get the chance.
Option 2: I know flow's are not as flexible as apex but you could give it a shot too based on what you are trying to achieve. Below is a link from Andrew Facet blog about leveraging flow Visual Flow with List View and Related List Buttons