Welcome to the nuBuilder Forums!

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

Sending reports with e-mail - alternative option

Questions related to nuBuilder Forte Reports and the Report Builder.
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Re: Sending reports with e-mail - alternative option

Unread post by nc07 »

Janusz wrote:Yeah :-)
it's working
thanks a lot Kev1n
Hi Januz,

Would you assist me with sending email from the database probably with a demo video. I am trying to follow this post to set up but unsuccessful.

Appreciate your time and assistance.

nc07
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Sending reports with e-mail - alternative option

Unread post by Janusz »

Hi,
Please find enclosed video with example how to set-up an email on completelly new nuBuilder instalation.
https://drive.google.com/file/d/1SaZFi- ... sp=sharing

basic steps:
1. Configure mail service in nuBuilder
as in video just use you mail data

2. Create procedure to send e-mail

Code: my_mail
Description: Mail
Run: Hidden

PHP (in the box):

Code: Select all

$to='jr_test@wp.pl'; 
$body= 
'Hi, 
This is email from nuBuilder. 

Regards 
Janusz'; 
$subj='Test #1'; 
$att=''; 
//$filesource = './upload-target/logo.png'; 
//$filename = 'logo.png'; 
//$att=array($filename => $filesource); 
nuSendEmail( $to, '', '', $body, $subj, $att, false);
3. Create button:

Label: Send Mail
ID: FF_but_mymail
onclick: nuRunPHPHidden('my_mail');

AND that's all.
If you press the button - then the mail will be sent to the given address
(in this case to jr_test@wp.pl)

If you want to send attachement - in the next step - unmark the lines in the php procedure and place the file in the folder.

Janusz
If you like nuBuilder, please leave a review on SourceForge
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Re: Sending reports with e-mail - alternative option

Unread post by nc07 »

Thanks, Janusz for your time and help.

I managed to set up the email function and all works well. The email attachments also worked fine when the file is placed in the folder.

A bit more to the attachment, how can I output a report to PDF and same is sent through email without manually saving it in the folder on the server. As per your assistance earlier, my pdf outputs with few fields data that it is not saving automatically to the server. Any suggestions on how this can be done.
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Sending reports with e-mail - alternative option

Unread post by Janusz »

Hi,
Normally you can apply the idea from the following post:
https://forums.nubuilder.cloud/viewtopic. ... 905#p19177
modifed nurunpdf.php
......
$PDF->Output('nureport.pdf', 'I');
// 2 lines belowe were added
$PDF->Output('/var/www/html/TestDB/uploads/nureport.pdf', 'F');
$y = shell_exec('send_pdf.sh');
// end
nuRemoveFiles();
.........
and replace the $y = shell_exec('send_pdf.sh'); with nuSendEmail(.....)
If you like nuBuilder, please leave a review on SourceForge
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Re: Sending reports with e-mail - alternative option

Unread post by nc07 »

Thank you, Janusz,

Your assistance and time are much appreciated.

After a few errors, I managed to get it working, thanks once again.

Regards
nc07
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Re: Sending reports with e-mail - alternative option

Unread post by nc07 »

Hi,

Is there any way to reduce the size of the PDF file as at the moment it outputs to about 1.78 MB which is not really that huge but just wondering if it is possible which might reduce the upload time.

regards
nc07
Janusz
nuBuilder Team
Posts: 506
Joined: Fri Dec 28, 2018 1:41 pm
Location: Krakow, Poland
Has thanked: 8 times
Been thanked: 18 times

Re: Sending reports with e-mail - alternative option

Unread post by Janusz »

Hi,
You can exclude fonts attachement to the generated pdf file.

in the nurunpdf.php at line c.a. 33

comment as following:

Code: Select all

//for($i = 0 ; $i < count($fl) ; $i++){
//      $fnt                                    = $fl[$i][0];
//      $PDF->AddFont($fnt, '', '', true);
//}
this should reduce the size from about 1.8M to few KB
If you like nuBuilder, please leave a review on SourceForge
nc07
Posts: 118
Joined: Tue Jun 04, 2019 4:05 am
Has thanked: 5 times
Been thanked: 22 times

Re: Sending reports with e-mail - alternative option

Unread post by nc07 »

Janusz wrote:Hi,
You can exclude fonts attachement to the generated pdf file.

in the nurunpdf.php at line c.a. 33

comment as following:

Code: Select all

//for($i = 0 ; $i < count($fl) ; $i++){
//      $fnt                                    = $fl[$i][0];
//      $PDF->AddFont($fnt, '', '', true);
//}
this should reduce the size from about 1.8M to few KB
Thanks Janusz,

This has really helped reduce the file size to 30kb which had decrease the upload time.

Really appreciated.

best regards,
nc07
Post Reply