+ 2

Is it possible to send a mail with PHP and SQL? How?

4th Jun 2020, 5:31 PM
Foxball
Foxball - avatar
1 ответ
+ 2
PHP can send email. PHP has a standard function called "mail" and you can get much more configurability from PHP libraries like PHPMailer. If you're new to sending emails in PHP, I strongly recommend PHPMailer because the extra configurability makes it easier to get your emails to someone's inbox. I struggled and never succeeded at getting the "mail" function to send email to anything but a SPAM folder. If you want something about the email defined in SQL, you can query SQL to get it. Maybe you have an email subject, email address, or an email template in an SQL database. I doubt you want SQL actually playing a direct role in sending an email or your question would have been much more specific. That said, SQL has more advanced features such as triggers that could be useful for having something like an SQL-insert invoke something like sending an email. An example using Microsoft SQL Server is mentioned at: https://stackoverflow.com/questions/10755469/send-e-mail-from-a-trigger
4th Jun 2020, 7:41 PM
Josh Greig
Josh Greig - avatar