We report a new method to synthesize nanostructured polyaniline by using the self-assembly of a mixture of an anionic surfactant sodium dodecylsulfate (SDS) and a non-ionic surfactant, Brij 35 (C12H25-(OC2H4)23-OH, a polyether and aliphatic hydrocarbon chain surfactant) as structure directing agents (SDA). The in situ polymerization of aniline was carried out at 277–278K in the presence of these SDAs with ammonium persulfate as the oxidant. Mesophase formation of the product polymer composites was studied with or without the addition of a co-surfactant molecule or by changing other synthesis parameters. Powder X-ray diffraction and transmission electron microscopic studies suggested wormhole-like disordered structure. N2 adsorption studies suggested the existence of mesopores with pore widths varying from small to large mesopores in these nanostructured materials, after the removal of the SDAs. The chemical bonding and electronic structure of the mesoporous polyaniline samples were also studied by FT-IR and UV–visible spectroscopic studies. These mesoporous polyaniline samples showed excellent luminescence and conducting properties at room temperature. These π-conjugated polymeric nanomaterials have huge potential in the fabrication of sensors, microelectronic, photo-devices and organic LEDs.