If you have a Form that gets user input, submits and adds to a MySQL db. You want to be alerted via email, and also send an email to the user thanking them. You decide PHPMailer is the safest way, but want to use PDO to avoid Injection hacks.
What would be the code for using PHPMailer with PDO (and probably a Try/Catch for error handling)

See the code snippets tab for PDO examples.

Thank you for your reply. I do not see a code snippets tap. Please direct me in the right location, as I would love to see the examples.

Thank you!

Hello!
Could you please to send me the code snippets tap for PDO examples that needs to PHPMailer? Thank you very much in advance.

Thank you for your reply! Sorry if I was not clear what problem I need to solve. I actually have a problem with the PHPMailer. My app (I run it on localhost) always displays this error message: SMTP connect() failed. I just don't know why. I tried many things to fix the error but no result. I thought PHP 8.2 was the problem but no. :( Maybe if you have any advice, I would love to hear it. Thank you very much in advance.

IIRC PHPMailer has a debug setting that allows you to see more issues. See the PHPMailer docs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.