The secondary metabolite 2,4,6-triphenylaniline (TPA) was isolated from an endophytic fungi Alternaria longipes strain VITN14G of mangrove plant Avicennia officinalis, that exhibited satisfactory in vitro antidiabetic activity for type 2 diabetes mellitus (T2DM). The TPA was encapsulated using