send email to many people

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
Dalila
User
Posts: 26

send email to many people

Post by Dalila »

Hi,
i used this code to send email to many people when a table is added.
The email arrives correctly but in the email box i saw that every account email customers are visible in the "to" field. Is it possible that the email arrives to my selected customers but each customer see only his name in the "to" field?

I post the code

/ Email Sending event
function Email_Sending(&$Email, &$Args) {

if (CurrentPageID() == "add") { // Means email sending by insert record.
$rsnew = $Args["rsnew"]; // get the $rsnew from the $Args array.
ew_Execute("SELECT email FROM utenti WHERE livello = 1", function($row) use (&$Email) {
if ($row["email"]) $Email->Recipient = $Email->Recipient . " , " . $row["email"];
});
}
return TRUE;

}

thank you so mutch


mobhar
User
Posts: 11702

Post by mobhar »

Dalila wrote:
Is it possible that the email arrives to my selected customers but each customer
see only his name in the "to" field?

No. For such case, then do not use "Email_Sending" server event. You need to use "ew_SendEmail" function (see this function from the generated "phpfn*.php" file).

Just make a loop to read/get all your recipient email using "Row_Inserted" server event, and inside that loop, just call that "ew_SendEmail" function to send email one-by-one to the specified email recipient.


Dalila
User
Posts: 26

Post by Dalila »

I do not deserve it because I did not write it.
I can try by myself, like de code above...

/ Email Sending event
function ew_SendEmail(&$Email, &$Args) {

if (CurrentPageID() == "add") {
$rsnew = $Args["rsnew"];

foreach($rsnew as $Email)
ew_Execute("SELECT email FROM utenti WHERE livello = 1", function($row) use (&$Email) {
if ($row["email"]) $Email->Recipient = $Email->Recipient . " , " . $row["email"];
});
}
return TRUE;

}

Tahnk you for help me.


mobhar
User
Posts: 11702

Post by mobhar »

ew_SendEmail is a built-in function and generated by PHPMaker. In other words, you don't need to create it again. You just need to call that function by supplying the parameter from you. For more info how to learn the function, see the code of ew_SendEmail from the generated "phpfn*.php" file.


Dalila
User
Posts: 26

Post by Dalila »

thank's I try


Post Reply