I have a method which sends an email with csv attachments. It works fine when I run it from the "execute anonymous window". All I am trying to do for now is have a button on a custom page which calls the method when I click it.
New to apex and visualforce so there could be something obvious I'm doing wrong.
I have a class with a method which takes 3 parameters defined like this:
public class EmailSpreadsheets {
public static void sendMail(String addressInput, String subjectInput, String monthYearInput) {
Visualforce page:
<apex:page controller="EmailSpreadsheets">
<apex:form >
<apex:commandButton value="Email Spreadsheets" action="{!sendMail('parameter1', 'paramater2', 'parameter3')}" />
</apex:form>
</apex:page>
I get this: "Error: Unknown function sendMail. Check spelling"
I've also tried removing the parameters so it is just:
action="{!sendMail}"
Then I get this: "Error: Unknown method 'EmailLeadSpreadsheets.sendMail()'"
Why isn't it recognising my method, and even if it did, where would I put the input parameters?