EXHIBIT 5.1 [LETTERHEAD] September 24, 1999 Allaire Corporation One Alewife Center Cambridge, Massachusetts 02140 Ladies and Gentlemen: We are familiar with the Registration Statement on Form S-1 (Registration No. 333-86563), as amended by Amendment No. 1 and Amendment No. 2 thereto (as amended, the "Registration Statement"), filed by Allaire Corporation, a Delaware corporation (the "Company"), with the Securities and Exchange Commission under the Securities Act of 1933, as amended. The Registration Statement relates to the proposed public offering by the Company of up to 1,150,000 shares (the "Company Shares") of its Common Stock, $.01 par value per share (the "Common Stock") to be issued by the Company and to the proposed public offering by certain stockholders of the Company (the "Selling Stockholders") of up to 1,610,000 additional shares (the "Stockholder Shares") of such Common Stock. (The foregoing number of Company Shares and Stockholder Shares assumes the exercise in full of the over-allotment option described in the Registration Statement.) We are familiar with the Company's Amended and Restated Certificate of Incorporation, its Amended and Restated By-Laws, the records of meetings and consents of its Board of Directors and of its stockholders provided to us by the Company, and its stock records. In addition, we have examined and relied on the originals or copies certified or otherwise identified to our satisfaction of all such corporate records of the Company and such other instruments and other certificates of public officials, officers and representatives of the Company and such other persons, and we have made such investigations of law, as we have deemed appropriate as a basis for the opinions expressed below. Based on the foregoing, it is our opinion that: 1. The Company has corporate power adequate for the issuance of the Company Shares in accordance with the Registration Statement. The Company has taken all necessary corporate Allaire Corporation September 24, 1999 Page 2 action required to authorize the issuance and sale of the Company Shares. When certificates for the Company Shares have been duly executed and countersigned, and delivered against due receipt of consideration therefor as described in the Registration Statement, the Company Shares will be legally issued, fully paid and non-assessable. 2. Upon the due execution, countersignature and delivery of certificates for the Stockholder Shares, the Stockholder Shares will be legally issued, fully paid and non-assessable. We consent to the filing of this opinion as an exhibit to the Registration Statement and to the reference to us under the heading "Legal Matters" in the prospectus forming part of the Registration Statement. Very truly yours, Foley, Hoag & Elliot LLP By: /s/ William R. Kolb -------------------------- A Partner