Page 1 of 1

Send for email the address url address added register

Posted: Sun Nov 26, 2017 1:10 pm
by eayvl

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

Thank very much.


Re: Send for email the address url address added register

Posted: Sun Nov 26, 2017 4:14 pm
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.


Re: Send for email the address url address added register

Posted: Tue May 15, 2018 7:29 am
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.


Re: Send for email the address url address added register

Posted: Tue May 15, 2018 10:10 am
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.


Re: Send for email the address url address added register

Posted: Thu May 17, 2018 2:28 am
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)


Re: Send for email the address url address added register

Posted: Thu May 17, 2018 4:21 pm
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.


Re: Send for email the address url address added register

Posted: Fri May 18, 2018 7:43 am
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


Re: Send for email the address url address added register

Posted: Fri May 18, 2018 12:00 pm
by mobhar

Try:

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


Re: Send for email the address url address added register

Posted: Sat May 19, 2018 12:58 am
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'])}";


Re: Send for email the address url address added register

Posted: Sat May 19, 2018 11:14 am
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.


Re: Send for email the address url address added register

Posted: Sat May 19, 2018 1:59 pm
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.


Re: Send for email the address url address added register

Posted: Sun May 20, 2018 1:19 pm
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'])}";


Re: Send for email the address url address added register

Posted: Sun May 20, 2018 1:22 pm
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.


Re: Send for email the address url address added register

Posted: Sun May 20, 2018 1:30 pm
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>";