Emailing a comment to an email address stored in a table
In a comment system, I am using variables called $comment
and $submittor
. I am using a MySQL table called "login" that contains fields called "username" and "email."
The field "email" is an email address.
I would like to send an email with $comment
in it to the "email" where "username" = "$submittor."
Here is what I have so far:
$queryem = sprintf('SELECT email FROM login WHERE username = $submittor');
How can I send the email?
Thank开发者_Python百科s in advance,
John
Better use PHPMailer library - it comes with freat tutorial based on GMail SMTP server:
http://phpmailer.worxware.com/index.php?pg=exampleagmail
Use PHP's mail
function:
mail($email, 'New comment!', $comment);
(More on emailing with PHP)
精彩评论