I have created class for sending a email and calling this "class" and "method" in new custom button..This logic works for "Detailed page Button"and for single record but how to make it work for List views for mass Email ?
This is the Class
global class outbound_Emails{ webservice static void SendEmailNotification (){ Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage(); mail.setToAddresses(new string[] {'[email protected]});// mail.setSenderDisplayName('From Name'); mail.setSubject('Sending a Email From SFDC'); mail.setHtmlBody('This is the Body for testing the send email function via custom button, which i should include in list view'); Messaging.sendEmail(new messaging.SingleEmailMessage[] {mail}); } }
This is the button
{!requireScript("/soap/ajax/20.0/connection.js")} {!requireScript("/soap/ajax/20.0/apex.js")} var retStr; retStr = sforce.apex.execute("outbound_Emails", "SendEmailNotification",{}); alert(retStr);