Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Send Sharable Link Code

Questions related to customising nuBuilder Forte with JavaScript or PHP.
kev1n
nuBuilder Team
Posts: 4299
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Send Sharable Link Code

Unread post by kev1n »

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 . "']);");
}
pmjd
Posts: 132
Joined: Fri Mar 12, 2021 10:38 am
Has thanked: 3 times
Been thanked: 1 time

Re: Send Sharable Link Code

Unread post by pmjd »

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
Post Reply