Targeting a Specific Contact Form for Altering I'm writing a custom module to format the email I receive from a user who fills out a contact form. I've created two contact forms and I want a separate email format for each form.

Code

I'm using this code as the basis of my module

But, I'm having trouble targeting a particular form. This is the code I'm trying to use, but it doesn't seem to be working:

    // further restrict mail_alter to machine name of a particular contact form
    if ($message['params']['contact_form']-&gt;id() == 
    'contact_message_contact_technical_support_form') {
    ...code to format message... (from linked article)
} 
elseif ($message['params']['contact_form']-&gt;id() == 
'contact_message_feedback_form_form') {
    ...code to format message... (from linked article)
}


Question

Would someone please tell me how to properly id my forms so I can target them?
Thanks for your help everyone. The comments were helpful. I ended up using the var_dump($message) as suggested and then whittled that down to what I needed. As one of you suggested the form name wasn't as long as I originally thought (and it WAS NOT the ID for the form). I think one ended up being 'feedback' and the other was, as you suggested 'contact_technical_support' or something like that.

The other issue I was having was that I was ignorantly naming my module with the word 'alter' in it which was overriding, or being overridden, by the alter hook it was using, I think.

At any rate, short answer is, my code basically works, but use var_dump($message) to find the correct ID of the forms and don't use 'alter' in the module name.