Hi, I have been using the php mail() function for all web forms on a website. I have learned about phpmailer and have a couple of questions that I hope someone can help answer. I have some knowledge of the mail() function but have not use phpmailer before.
1. Is there anything bad about using php mail() function? (e.g. more vulnerable than phpmailer, etc)
2. I need to have html content and inline images for the emails that goes to the user (e.g. send to a friend email) is phpmailer better than the mail() function?
3. What is the advantages of phpmailer over mail() function?
4. is phpmailer or swiftmail hard to learn compare to mail() function?
Swiftmailer and PHPMailer are probably the two most popular 3rd party mail packages for sending email from within PHP code. I use PHPMailer mainly because it's the one I know, but I know more than a couple people who prefer Swiftmailer -- but whichever you use will get the job done, I think.
The advantage of using them over the native mail function is that they take care of a lot of the detailed grunt work so that you don't have to. They make it much easier to do things like sending HTML email (with plain text alternative content) and file attachments, sending via a separate SMTP account on another server, taking care of setting the right headers and dealing with basic email security concerns, and so forth. It's nothing you couldn't do yourself with built-in PHP -- after all, PHPMailer is nothing but a library of PHP code -- but unless you want to do all the work yourself as some sort of learning exercise, why bother?
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation