Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Salesforce by (13.1k points)

I was trying to implement an Apex Script, and I ran into an error like this:

Line: 4, Column: 14 Method does not exist or incorrect signature: void sendMail(String, String, String) from the type EmailManager

Can anyone help me solving this?

This is my apex code :

public class EmailManager 

{

    public static void sendMail(String address, String subject, String body) {

        Messaging.SingleEmailMessage mail = new 

Messaging.SingleEmailMessage();

        String[] toAddresses = new String[] {address};

        mail.setToAddresses(toAddresses);

        mail.setSubject(subject);

        mail.setPlainTextBody(body);

        Messaging.sendEmail(new Messaging.SingleEmailMessage[] { mail });

    }

}

1 Answer

0 votes
by (26.7k points)
edited by

The sendMail function there takes 3 arguments, so you need to make sure that your test class have 3 arguments as well into the method. It should be like this:

EmailManager.sendMail('address', 'subject','body');

I hope this will work.

Want to become a salesforce expert? join Salesforce Training now!!

Related questions

Browse Categories

...