People with an optimistic outlook are far less likely to die from a heart attack than those who are downbeat about life.