Send Sharable Link Code

Questions related to customising nuBuilder Forte with JavaScript or PHP.

Re: Send Sharable Link Code

Unread postby kev1n » Fri Oct 01, 2021 2:15 pm

Use this code in the procedure and the result of nuSendEmail() will be displayed:

Code: Select all
$recordURL = nuGetRecordURL('', 'nubuilder', 'nuuserhome');

$body = $recordURL;

$to = 'to@test.com'; // replace with recipient email address
$from = 'from@test.com'; // replace with from email address
$fromName = 'from Name'; // replace with from name
$subject = 'test';
$cc = '';
$bcc = '';

$result = nuSendEmail($to, $fromAddress, $fromName, $body, $subject, array(), true, $cc, $bcc);

if (count($result) == 2) {
    showMessage(nuTranslate('Result'), $result[1]);
} else {
    showMessage(nuTranslate('Result'), $result[1].'<br>'.$result[2]); 
}   

function showMessage($title, $msg) {
    nuJavascriptCallback("nuMessage(['<h2>".$title."</h2><br>" . $msg . "']);");
}
kev1n
nuBuilder Team
 
Posts: 2063
Joined: Mon Oct 15, 2018 2:13 am
nuBuilder Version: 4.5

Re: Send Sharable Link Code

Unread postby pmjd » Fri Oct 01, 2021 10:45 pm

Thanks kev1n, the code actually throughs a couple of errors but after leaving it overnight and coming back to it this morning the original code seems to be working, maybe a cache issue on my part?

It works quite sliently, I'll try and work on using it in conjunction with nuEmail so it pulls the info and puts it in to a seperate form like that used to test email settings so the recipient can be more easily changed by the end user.

Thanks for your help as always
pmjd
 
Posts: 103
Joined: Fri Mar 12, 2021 7:08 pm
nuBuilder Version: 4.5

Previous

Return to Custom Code

Who is online

Users browsing this forum: No registered users and 11 guests