This topic is locked

Query and email from another table

9/27/2010 10:15:19 AM
PHPRunner General questions
J
jasonfrew author

Hi all
i have a process where by the information held in a quote table is attached to the customer table by the customer id.

I have a view that joins both of these tables in order that the full quite details be shown.

I would like to email the full quote information from the view when a quote is entered into the quote table.
I think it would go allong the lines of: quote table updated select * from view.
I have the following in the after record added event :
$email="my.address@mydomain.com";

$from="my.system@mydomain.com";

$msg="";

$subject="A new Quote has been added to the system";
foreach($values as $field=>$value)

{

if(!IsBinaryType(GetFieldType($field)))

$msg.= $field." : ".$value."\r\n";

}
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from));

if(!$ret["mailed"])

echo $ret["message"];
This is enough to send from the database im updating.
Also i would like to be able to email only the person adding the record without having to hardcode a group of users into the event, as people will come and go within the company.
I have usernames and email addresses stored in a users table

Sergey Kornilov admin 9/27/2010

Here is an example of sending mass mail to all users:

http://xlinesoft.com/phprunner/docs/send_email_to_email_addresses_from_user_table.htm
You can combine these two code samples to send a customized email to all users.