tags:

views:

27

answers:

2

Hello,

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?

Thanks in advance,

John

+1  A: 

Use PHP's mail function:

mail($email, 'New comment!', $comment);

(More on emailing with PHP)

Josh Leitzel
+2  A: 

Better use PHPMailer library - it comes with freat tutorial based on GMail SMTP server:

http://phpmailer.worxware.com/index.php?pg=exampleagmail

Tomasz Kowalczyk