I use to develop in java where i can extend a class that implement an interface.

This way, the child-class implement the interface too and extends the overrided methods.

I am trying to do the same kind of thing with apex to optimize my webservices.

I want

  • an abstract class that implement Messaging.InboundEmailHandler and contains a constructor with 2 parameters
  • several child class that call super(param1, param2)

I can code everything in setup > apex class.

But when a icreate the email service then send my email, i get this error message : The apex class Mail2Lead_IDM_RenaultCarpentras does not implement the Messaging.handleInboundEmail method.

Here is my code.

global abstract class Mail2LeadParent implements Messaging.InboundEmailHandler{
    public Mail2LeadParent(String code, String brand){
        // do things with parameters ...

    global Messaging.InboundEmailResult handleInboundEmail(Messaging.InboundEmail email, Messaging.InboundEnvelope envelope) {
        String htmlContent=email.htmlBody;
        return null;

    public void execute(String htmlContent){
        // to things  

global class Mail2LeadChild extends Mail2LeadParent{
    public Mail2LeadChild(){

I can call an instance of Mail2LeadChild then launch execute().

I could, of course, create classes without inheritance and send my content and parameters to another 'handler' class but I would like to understand why inheritance does not work with interface implementation.


I am also a java guy, and I ran into this same problem, and it frustrates the hell out of me.

A quick workaround I did was declared the handleInboundEmail method as virtual in my top-level abstract class and then in my concrete classes just put this:

    public override Messaging.InboundEmailResult handleInboundEmail(
        Messaging.InboundEmail email,
        Messaging.InboundEnvelope env)
        return super.handleInboundEmail(email, env);

Even before I added that it was obvious that the method is there since I was calling it (directly on my concrete class) in some unit tests. I would think it would be an easy fix to have the email service subsystem recognize that it's there without it having to be explicitly declared. Oh well...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.