Page 2 of 2

Re: Send Sharable Link Code

Posted: Fri Oct 01, 2021 6:45 am
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 . "']);");
}

Re: Send Sharable Link Code

Posted: Fri Oct 01, 2021 3:15 pm
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