Send for email the address url address added register

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

Send for email the address url address added register

Post by eayvl »

Hi, how to send by email the url address of the added register.

Thank very much.


mobhar
User
Posts: 11660

Post by mobhar »

You may simply use "ew_SendEmail" global function. See the code in the generated phpfn*.php file.

Just refer to the generated <usertable>info.php file, for example, from the demo project, just refer to the "employeesinfo.php" file, and see the "PrepareRegisterEmail" function in it.


eayvl
User
Posts: 315

Post by eayvl »

It still does not work correctly, I put it for discussion

$Email->Content .= "<BR>\n\r". "$url=carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id=". urlencode($this->carpeta_red_id->CurrentValue);

Thanks.


mobhar
User
Posts: 11660

Post by mobhar »

There is not "CurrentValue" in that event, that's why it won't work.

So please read "Server Events and Client Scripts" topic from PHPMaker Help menu for more info and example.


eayvl
User
Posts: 315

Post by eayvl »

When I add a record to the table, the email is sent, in the body of the email is the link "URL", the user must click on the link and will be redirected to the record that was added, that's what I need;

The mail comes out of "Email_Sending"
$Email->Content .= "<BR>\n\r". "$url=carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id=". urlencode($this->carpeta_red_id->CurrentValue);

I think the structure is correct according to the example:

Example 3
If you have just added a master record and want to go to Grid-Add page of the detail table, enter: (with quotes)

"<DetailTable>list.php?a=gridadd&showmaster=<Table>&fk_<KeyField>=" . urlencode($this-><Field>->CurrentValue)


mobhar
User
Posts: 11660

Post by mobhar »

As I mentioned before, there is no "CurrentValue" property of the Field object in "Email_Sending" server event. Your code will never work if you are stil keep using "CurrentValue".

Please read "Server Events and Client Scripts" topic from PHPMaker Help menu, and see "Email_Sending" event for more info and example how to expose the value of the certain field.


eayvl
User
Posts: 315

Post by eayvl »

I'm sending the "ID" in the mail but it does not reach me as Link; how can I add this part "h t t p://localhost:8081/project/"

Code:
$Email->Content .= "<BR>\n\r". "$url=carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}";

In the mail:
=carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id=2


mobhar
User
Posts: 11660

Post by mobhar »

Try:

echo substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) ."/";


eayvl
User
Posts: 315

Post by eayvl »

It does not work.
$Email->Content .= "<BR>\n\r". "echo substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) ."/". carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}";

It does not work.
echo substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) ."/", "carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}";


mobhar
User
Posts: 11660

Post by mobhar »

mobhar wrote:
echo substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) ."/";

The "echo" is only for displaying the output. You should not include it if you want to concate the output with another string.


eayvl
User
Posts: 315

Post by eayvl »

I think it is correct,

$Email->Content .= "<BR>\n\r". "substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) ."/". carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}";

In the body of the mail appears only "NAN" I need the link to go to the record that was added.

The URL is already in the mail when I add a record, now I try to convert the link into "CLICK HERE"

Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\project\carpetas_red_bitacorainfo.php on line 1300

$Email->Content .= "<BR>\n\r". <a href=substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) ."/". "carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}";>Click here</a>

Thanks.


mobhar
User
Posts: 11660

Post by mobhar »

Double check your code:
$Email->Content .= "<BR>\n\r". "substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) ."/". carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}";

It should be like the following:
$Email->Content .= "<BR>\n\r". substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) . "/carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}";


eayvl
User
Posts: 315

Post by eayvl »

The URL is already in the mail when I add a record, now I try to convert the link into "CLICK HERE"

Parse error: syntax error, unexpected '<' in C:\xampp\htdocs\project\carpetas_red_bitacorainfo.php on line 1300

$Email->Content .= "<BR>\n\r". <a href=substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) ."/". "carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}";>Click here</a>

Thanks.


mobhar
User
Posts: 11660

Post by mobhar »

Change:
$Email->Content .= "<BR>\n\r". <a href=substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) ."/". "carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}";>Click here</a>

to:
$Email->Content .= "<BR>\n\r<a href='" . substr(ew_FullUrl(), 0, strrpos( ew_FullUrl(), '/')) . "/carpetas_red_bitacoralist.php?showmaster=carpetas_red&fk_carpeta_red_id={$this->UrlEncode($Args['rsnew']['carpeta_red_bitacora_employee_id'])}'>Click here</a>";


Post Reply