M [n_] := 
      Table[If[i == j, d, 
          If[(i == 1 || j == 1), e, 0]], {i, 1, n}, {j, 1, 
          n}]

MatrixForm[M[6]]

Eigenvalues[M[6]]