This topic is locked

sending email

12/12/2006 11:47:28 AM
PHPRunner General questions
A
airwolf author

Hi,
i would like to send an email to an user. The email adress is in the user table, and i want to send a notification to him, when the record will be changed,

(eg. the userstatus is active and will be set to inactive. )
select `EMAIL`,

`PASSWORD`,

`INSERT_DATE`,

`FILTER`,

`ACTIVE`,

`FAMILY_NAME`,

`STREET`,

`ZIP`,

`TOWN`

From `usertab`
EMAIL ist the Email Adress form the user.
Thanks

Rainer

Sergey Kornilov admin 12/12/2006

You can use BeforeEdit Event and one of sample actions that send an email.

L
lawfour 12/12/2006

Hi airwolf,
This the code I use:
$email=$values["Email"]; Email is my field name in db, replace with your field name

header section is the Return & CC email address, who the email is coming from and copy to someone else.
hope this helps
L
function BeforeEdit(&$values, $where)

{
// Parameters:

// $values - Array object.

// Each field on the Edit form represented as 'Field name'-'Field value' pair

// $where - string with WHERE clause pointing to record to be edited
//** Send email with new data ****
$email=$values["Email"];

$message="";

$subject="";

$headers = "From: YOUR EMAIL" . "\r\n" . "CC: ANOTHER EMAIL";
foreach($values as $field=>$value)

$message.= $field." : ".$value."\r\n\n";
mail($email, $subject, $message, $headers);
return true;
// return true if you like to proceed with editing this record

// return false in other case
}

Hi,

i would like to send an email to an user. The email adress is in the user table, and i want to send a notification to him, when the record will be changed,

(eg. the userstatus is active and will be set to inactive. )
select `EMAIL`,

`PASSWORD`,

`INSERT_DATE`,

`FILTER`,

`ACTIVE`,

`FAMILY_NAME`,

`STREET`,

`ZIP`,

`TOWN`

From `usertab`
EMAIL ist the Email Adress form the user.
Thanks

Rainer

A
airwolf author 12/13/2006

Hi Larry,
thank you very much for your help, it works fine and i am happy.
Is it possible, to send the label names and not the tablefield names ?
Rainer

Sergey Kornilov admin 12/13/2006

Rainer,
instead of $field you can use Label($field) while composing email message.

A
airwolf author 12/14/2006

Works great, thank you very much