Najdi a stahni si třídu PHPmailer + dokumentaci. Ta je specializována pro práci s emaily.
Zpět do poradny