The nonlinear optical (NLO) properties of a series of anilines and N,N-dimethylanilines are studied with second-order Møller-Plesset perturbation theory (MP2). The effect of solvents on the calculated NLO properties is investigated by considering a wide range of solvent systems within the polarizable continuum model. In order to identify systems with high first-order hyperpolarizability, the effects of four basic variations to the molecules on the calculated NLO properties are studied. The modifications comprise changes to the donor strength (NH₂ to N(CH₃)₂), changes to the acceptor strength (NO₂, CN and CHO), variation of additional substituents (H, CH₃, Br, OCH₃), and changes in the conjugation length. It is found that the first-order hyperpolarizability increases when the compounds have N,N-dimethyl as donor, vinyl nitro group as acceptor at the 4-position, and a methoxy group as substituent at the 2-position.