Send email with attachment PDF - Mobile

Hi everyone, I need to convert an expression to PDF and send it by email, someone knows how to do it ?, by the link (https://success.outsystems.com/Documentation/Development_FAQs/How_to_send_emails_with_attachments) I did not find anything (the page does not exist)

Rank: #175

Need more information. Are you wanting to send the email from the app with no user intervention? Or use the native email capabilities of the mobile device?

There are tons of ways to generate PDFs (including server-side using something like Html2PDFGenerator, or calling a REST service), so if you can be a little more specific about the use case you want to support, it will be easier to recommend the best approach for that use case.

Rank: #783

I guess you want to send a pdf as an attachment with your email. In Mobile I would use "Html2PdfConverter" from the forge and create the PDF you want (which is binary data)

Than you need to create a server action in the web module, that will send the mail and give the Binary Data as input parameter. You have to save this binary data since an attachement within an email is build in the preparation (Binary Data can't be input parameters for Emails).

Now go to your mobile module, and reference the server action (the module will appear in the list).

You will have to create a Server Action in your mobile module to call the Server Action in the Web Module.

Good luck!

Rank: #175

You specifically mentioned mobile, so part of what I was trying to get at is whether you want the PDF sent from the device itself using the user's email app, or whether sending from the server (as outlined by Martin Rozeboom above) would be sufficient.

If sending from the server is sufficient, then Martin's answer should work for you.

What Martin didn't mention is that you need to create a HTML string that will contain the document that you want to send as PDF. Creating this HTML string will involve some manual action since OutSystems doesn't have any handy tools available for that. When you have created the HTML you can then use the already mentioned components to convert the HTML to PDF as a Server Side action. If you need to have a mobile only solution for converting the HTML to PDF you can use the PDF Generator Plugin (https://www.outsystems.com/forge/component-overview/2429/pdf-generator-plugin)

I am using the forge component "Html2PdfConverter" but I have the error "Access to the path 'C: \ test \ binaries 'is denied."


I checked everything and I could not solve it, can anyone help me?

Hi Murilo, 

Html2pdf converter works based on libraries wkhtmltopdf(https://wkhtmltopdf.org/), you need to upload binaries from admin page and uploaded folder should be accessible from the component. It seems you did not uploaded the binaries. Please check