Play animation OnTriggerEnter (C#)

I’ve never got my head around this but I play animation through a script. so it writes to the console but doesn’t play an animation.

 using UnityEngine;
 using System.Collections;
 
 public class DoorTrig : MonoBehaviour {

     public GameObject door;
 
     void OnTriggerEnter (Collider other)
     {
       if(other.name == "FPSController")
         {
             door.GetComponent<Animation>().Play("DoorOpen"); //Should play the animation
             Debug.Log("Now the animation clip should play");
         }
     }
 }

Heres the Solution:

Thanks to danivdwerf:

http://answers.unity3d.com/users/845079/danivdwerf.html

give him a follow