“Humor must not professedly teach, and it must not professedly preach, but it must do both if it would live forever. By forever, I mean thirty years.”
Mark Twain in eruption: hitherto unpublished pages about men and events, 1940, Mark Twain, Bernard Augustine De Voto, Harper & brothers. This appears to be the origin of the variant:
If you would have your work last forever, and by forever I mean fifty years, it must neither overtly preach nor overtly teach, but it must covertly preach and covertly teach.
Attributed to Twain by J. Michael Straczynski in The complete book of scriptwriting, 2002, Writer's Digest Books
Help us to complete the source, original and additional information
Mark Twain 637
American author and humorist 1835–1910Related quotes

Letter to W.T. Barry http://press-pubs.uchicago.edu/founders/documents/v1ch18s35.html (4 August 1822), in The Writings of James Madison (1910) edited by Gaillard Hunt, Vol. 9, p. 103; these words, using the older spelling "Governours", are inscribed to the left of the main entrance, Library of Congress James Madison Memorial Building.
1820s
Context: A popular Government without popular information, or the means of acquiring it, is but a Prologue to a Farce or a Tragedy, or perhaps both. Knowledge will forever govern ignorance: And a people who mean to be their own Governors, must arm themselves with the power which knowledge gives.

“We must use time creatively - and forever realize that the time is always hope to do great things.”

Letter to W.T. Barry http://press-pubs.uchicago.edu/founders/documents/v1ch18s35.html (4 August 1822), in The Writings of James Madison (1910) edited by Gaillard Hunt, Vol. 9, p. 103; these words, using the older spelling "Governours", are inscribed to the left of the main entrance, Library of Congress James Madison Memorial Building.
1820s
Source: The Road Less Traveled: A New Psychology of Love, Traditional Values and Spiritual Growth

The Rickover Effect (1992)
Context: When doing a job — any job — one must feel that he owns it, and act as though he will remain in that job forever. He must look after his work just as conscientiously, as though it were his own business and his own money. If he feels he is only a temporary custodian, or that the job is just a stepping stone to a higher position, his actions will not take into account the long-term interests of the organization. His lack of commitment to the present job will be perceived by those who work for him, and they, likewise, will tend not to care. Too many spend their entire working lives looking for the next job. When one feels he owns his present job and acts that way, he need have no concern about his next job.
“You must gain control over your money or the lack of it will forever control you.”

1960s, I Have A Dream (1963)
Context: Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again we must rise to the majestic heights of meeting physical force with soul force.
Context: The whirlwinds of revolt will continue to shake the foundations of our nation until the bright day of justice emerges. But there is something that I must say to my people who stand on the warm threshold which leads into the palace of justice. In the process of gaining our rightful place we must not be guilty of wrongful deeds. Let us not seek to satisfy our thirst for freedom by drinking from the cup of bitterness and hatred. We must forever conduct our struggle on the high plane of dignity and discipline. We must not allow our creative protest to degenerate into physical violence. Again and again we must rise to the majestic heights of meeting physical force with soul force.