Implanting materials in the body to program host immune cells is a promising alternative to transplantation of cells manipulated ex vivo to direct an immune response, but doing so requires a surgical procedure. Here we demonstrate that high-aspect-ratio, mesoporous silica rods (MSRs) injected with a needle spontaneously assemble in vivo to form macroporous structures that provide a 3D cellular microenvironment for host immune cells. In mice, substantial numbers of dendritic cells are recruited to the pores between the scaffold rods. The recruitment of dendritic cells and their subsequent homing to lymph nodes can be modulated by sustained release of inflammatory signals and adjuvants from the scaffold. Moreover, injection of an MSR-based vaccine formulation enhances systemic helper T cells TH1 and TH2 serum antibody and cytotoxic T-cell levels compared to bolus controls. These findings suggest that injectable MSRs may serve as a multifunctional vaccine platform to modulate host immune cell function and provoke adaptive immune responses.