Frances Hodgson Burnett said this quote

One of the new things people began to find out in the last century was that thoughts- just mere thoughts- are as powerful as electric batteries- as good for one as sunlight is, or as bad for one as poison. To let a sad thought or a bad one get into your mind is as dangerous as letting a scarlet fever germ get into your body. If you let it stay there after it has got you in you may never get over it as long as you live.