TITLE: When does End(M) consist entirely of zero, zero divisors, and units?
QUESTION [5 upvotes]: Let $R$ be a commutative ring (with $1$) such that every non-zero divisor in $R$ is a unit (see Rings in which every non-unit is a zero divisor for various stabs at what these are called). Let $M$ be a finitely generated $R$-module. 
My question: 

Can we conclude that every non-zero divisor in $\mathrm{End}(M)$ is a unit?

For example: When $M$ is a free module, we have $\mathrm{End}(M) \cong R^{n \times n}$ is a matrix algebra and so every non-zero divisor is a unit (see Do these matrix rings have non-zero elements that are neither units nor zero divisors?).
A few notes:

Even matrix algebras can misbehave when $R$ is non-commutative. Also, if $R$ has a non-zero divisor which is not a unit, then $\mathrm{End}(R)=R^{1 \times 1}=R$ has a non-zero divisor which is not a unit (thus the assumptions on $R$).
If $V$ is an infinite dimensional vector space (over some field). Then $\mathrm{End}(V)$ has non-zero divisors which aren't units (thus the "finitely generated" assumption).
If the answer to the question is "No" (I'd like a counter-example), then I would like to know under what circumstances $\mathrm{End}(M)$ does have this property. What assumptions on the module will force this to hold? (e.g. This holds when $M$ is a ??? module -- like flat or projective or something.) Or what assumptions on the ring will force this to hold for all modules? (e.g. This obviously holds when $R$ is a field.)
Motivation and background: I've been working with a few undergraduates on a related problem. We tripped over this question and I have no idea whether this is true or not (I'm not a ring theorist and have a feeling this may be a difficult question to entirely resolve). 

Thanks for reading my question! We (my group of undergrads and myself) appreciate your help!

REPLY [7 votes]: Counterexample: $R=k[[x,y]]/(x^2,xy)$ and $M = R/(x) \cong k[[y]]$.

REPLY [7 votes]: Here is a small positive result: If $R$ is Artinian, $End_R(M)$ is an $R$-algebra which is f.g. as $R$-module, hence Artinian, hence classical (as I call these rings, following Lam).
On the other hand, as soon as the Krull dimension of $R$ is $\geq 1$, $M = R/p$ for a non-maximal prime ideal $p$ will give a counterexample, as in Graham's answer.
Added: I think if $R$ is Noetherian (hence semilocal by a theorem of Faith, see Lam's Lectures on Modules and Rings theorem 8.31 p. 283), the assertion is true for $M$ f.g. projective (= f.g. flat).
Because then $R \simeq \prod_{i=1}^{n} R_i$ with indecomposable semilocal $R_i$ with corresponding idempotents $e_i$, $End_R(M) \simeq \prod End_{R_i}(e_i M)$ and $e_iM$ is f.g. projective over $R_i$. We can thus reduce to the indecomposable case, and here f.g. projectives are free (this remains true without "f.g.", says Hinohara), so we are done by the OP's second link.