launching lotus notes from javascript - javascript

Any idea how to launch lotus notes from javascript and attach a document to a new mail programmatically. I know many will find it absurd.. but my stake holders seem to have a fascination with impossible feats!
could it be done via an xPage?

You can actually extend the mailto url abit and get a subject, body text and an attachment too
mailto:someone#example.com?subject=my new email&body=attachment below&attachment=c:\temp\thefile.txt
The attachment must be stored on a drive that the machine can access it's not and url.
And you might need double slashes.

If Lotus Notes is the default mail client (which it usually is if its an enterprise environment), then all you need to do is create a mailto: link.
For example:
Send email
This can be customised to include a subject or a body, and when clicked in a webpage will launch the default mail client and which should then populate form.

Related

unable to add image into email using ui5/javascript

I need to send a vizframe to email, to achieve this I converted the chart into an image. but I am unable to add this image to my email.
I can do same thing for text but not for an image.
i.e.: new sap.m.Text({text: "stackoverflow"}).getText() does the job for me.
any help will be highly appreciated.
UI5 only allows you to trigger the email client and pre-populate some plain text fields. You can check out the documentation for the URLHelper class.
If you also want to add an attachment (the picture), I don't think you will be able to. Check out this other question on StackOverflow: Automatically open default email client and pre-populate content. The only "good" way of doing it seems to be to just include a link towards your image inside the mail (assuming that the image is accessible via a URL).
Based on this question Press button, start native email program with attachment (located on webserver) it seems that some clients might allow you to specify the local path to the image (but in UI5 I don't see how you would know a path on the local machine).

Can I use the Gmail API to get the MD5 hash value for an attachment?

I work in an email security software company and we are currently faced with the question of being able to identify attachments in emails. Since we are cloud hosted, we need to be able to do this with Gmail and Outlook. It looks like the Outlook API will give you an atttachment hash under ContentBytes, but Gmail looks very limited in the attachment data it gives back to you.
Is there something I'm missing here?
Attachments in emails are classified as content types in email.
Which you want to do is pull the content types off the emails
Emails with attachments usually have more than 1 content type associated to it.
Take a look at this RFC: https://www.ietf.org/rfc/rfc2045.txt
In an email I had, I looked at the RAW Text of one that had a PDF attachment and seen this content type.
Content-Type: application/pdf;
Then one that had an image attached to it.
Content-Type: image/jpeg;
You wouldn't need a special API to read this, just get the raw text of the message and parse it out.

Email xepOnline generated file

I am currently using xepOnline to generate a pdf of my page.
This is working perfectly , but i now want a button next the download button which opens the mail program on your pc and attaches the generated pdf file.
My code so far: (not much)
function emailCurrentPage(){
window.location.href="mailto:?subject="+document.title+"&body="+escape(window.location.href);
}
<button onClick="javascript:emailCurrentPage()">Doormailen</button>
<button href="#" onclick="return xepOnline.Formatter.Format('content',{render:'download'},{pageWidth:'216mm', pageHeight:'279mm'}, {filename:'Test'});">Opslaan als PDF</button>
The syntax of mailto does not accept attachments. See the following as one description.
https://yoast.com/dev-blog/guide-mailto-links/
You would only be able to open the email itself with the TO, CC, BCC, Subject and Body filled out and the user would have to manually attach the PDF downloaded.
In #cloudformatter, the PDF is returned and is stored in the response. You could override the response handler to resend that PDF to a server-side application that sends the email for you.
As one of the authors of the xepOnline script and the server-side application that is handling the requests and formatting the PDFs, we already developed and have such functionality in the server itself. It is not available in the free-to-use version as we cannot support tens of thousands of emails sent daily by the users.

Acrobat Javascript: passing a UTM parameter from URL into a PDF button

I have a PDF that has a button with field name ctaButton.
ctaButton currently has a url pointing to https://mywebsite.com.
I want to host the PDF on my server at https://mywebsite.com/hosted.pdf.
And when I send someone a link to the PDF, I want to attach a UTM_term parameter ?utm_term=customer1 and then have the PDF read this parameter and update the ctaButton url to https://mywebsite.com/?utm_term=customer1.
I've been messing around with the Javascript actions in Acrobat for a couple of hours trying to make this happen. Any help greatly appreciated.
You can get the full url to the document using...
var myURL = this.url;
"this" in Acrobat JavaScript is the document context.
I did hours of research and came to this conclusion – Javascript in Acrobat is like trying to code in 1985 AND browsers will not execute whatever code you come up with.
So I used this workaround:
When I send the PDF to someone, I send it as a link with a base64
encoded stringified JSON package that contains a bunch of tracking
data but importantly, the name of the file to access as well as utm
parameters specific to the recipient
The link hits a server handler (NodeJS) that extracts the encoded
JSON package, and uses the data in the package to serve up an HTML
redirect page pointing to the right PDF file
Importantly, the HTML page also saves the JSON package to the
browser's localStorage . . . this comes in handy in subsequent
steps
The PDF file opens in browser (it doesn't have to, could be opened on
desktop) and the call to action link has a link to a get request
handler
The get request handler serves up ANOTHER redirect page
This second redirect page accesses the browser's local storage, looks
for the utm parameters I set for that user, and then redirects to the
sale page, with nice utm parameters attached
So to sum up, you don't add the utm parameters to the call to action link in the PDF (because that would make the world too easy to live in) and instead you do all these acrobatics (no pun intended) to attach utm parameters in the link clicks (via JSON strings saved in localStorage) during the process (i.e. when user opens email to extract file via link, and then when user clicks call to action in the PDF).
Any questions or clarifications please let me know in the comments and I will do my best to address.
Caveats
Only works if user uses same browser in all steps (i.e. if Susan opens the email in Safari, saves the PDF, then clicks the call to action in the PDF, and the link opens in Chrome, utm parameters will not be passed).
Assumes browser is modern and has localStorage
UPDATE: I came across another solution. It's a bit more convoluted. Diagram below.
Porky.io is a Javascript extension for Adobe Indesign. So flow is:
send Porky.io the customer data you need (e.g. utm's for links)
Porky.io generates PDF from a template you provide with the customer data you provided
Listen for a new file save from Porky
Do something with the file (e.g. email it to customer)
I believe you need to run an instance of Windows somewhere in the cloud (e.g. on Azure) to run Indesign with the Porky.io. Unless you want to rely on your laptop.
My project's not big enough yet to warrant setting this up . . . but good alternative if I need to make my current solution more robust.

How can I add a signature into an Outlook email with JavaScript mailto?

I am using JavaScript mailto function to fill an email body with custom text.
I can add text to the email but the signature doesn't show up.
Is there any way to send a custom signature with an image using mail-to function?
Or is there any way to insert an HTML image in the body when using the mail-to function?
Sample code:
var message = "text of message";
var mailLInk = "mailto:sam#example.com?subject=subject&body=" + message;
document.location.href = mailLink;
Section 2 of RFC 2368 says that the body field is supposed to be in text/plain format, so you can't do HTML.
However even if you use plain text it's possible that some modern mail clients would render the resulting link as a clickable link anyway, though.
No, that information is stored in the outlook profile. Its up to Outlook (or some setting) on how to deal with the URL.
currently there is no way to send an html, because only plain text is accepted, and I can give you some tips why not to use mailto to send email:
Disadvantages of mailto in HTML
Mail address can be read by spam bots
Mailto only works if visitor have configured mail client
HTML mailto screams "This site is developed by begginer"
There is only one advantage and its easy to create and implement into web site. But if you want to use it just encode your mail address so it can't be read with spam bots.
But if you want to add footer in your mail message, then just in your body parameter add %0A, %0A is new line and your cursor will blink there so ?body=%0AThen your footer text will give you footer in email.
:)

Categories