PDA

View Full Version : Making use of the vbmail function ?


cinq
08-07-2004, 01:50 PM
Am planning to make use of this function to notify a member ( via email ) when someone comments on something he/she posted.


$subject= Email Notification: New Comment Posted';
$message="A new comment was posted. Please login to check.";
vbmail($vboptions['webmasteremail'], $subject, $message);


Now this code would send the email notification to the webmaster ( ie. me ).
But say this email notification was supposed to be sent to a member called "Helloworld", how can I pass it into the vbmail function , using his userid ?

Will this work ? :
( assuming data[userid] came from a query result )

$usersid = $data['userid'];
$user = fetch_userinfo($usersid);
$username = $user['username'];

$subject= Email Notification: New Comment Posted';
$message="A new comment was posted. Please login to check.";
vbmail($user['username'], $subject, $message);


Any advice would be much appreciated. :)
Thanks

nexialys
08-07-2004, 02:22 PM
this is the right way to do it... ;)

Modin
08-07-2004, 03:10 PM
$usersid = $data['userid'];
$user = fetch_userinfo($usersid);
$username = $user['username'];

$subject= Email Notification: New Comment Posted';
$message="A new comment was posted. Please login to check.";
vbmail($user['username'], $subject, $message);



close but I think you want

$usersid = $data['userid'];
$user = fetch_userinfo($usersid);
$username = $user['username'];

$subject= 'Email Notification: New Comment Posted';
$message="A new comment was posted. Please login to check.";
vbmail($user['email'], $subject, $message);


Modin

cinq
08-07-2004, 03:16 PM
Cool, thanks for the prompt replies folks.
Thanks Modin for that correction :)

tazzarkin
03-19-2008, 06:39 PM
does this still work? or is this invalid?