I am looking at two classes used for sending emails from PHP scripts. One uses fsocketopen
to port 25 and the other uses PHP mail()
for sending. I understand with fsocketopen
I can do better error handling based on server responses, other than that, what are the pros / cons for each? Or if anyone could point me to documentation - I've been unable to find information on the pros and cons - that would be equally helpful.
mail
does everything for you, fsocketopen
requires you write the all the headers for the email. If you're fine with doing it manually, fsocketopen
is a decent approach. They both have their trade offs.. mail
is easy but slightly more restrictive, fsocketopen
is harder to use, but allows you to do whatever you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.