I want to create a new document in javascript and generate a new mail with it. I fill the body, sendto and subject of the mail and then I want to open the mail in Lotus Notes Client.
How can I open this mail in the mail client?
I want to create a new document in javascript and generate a new mail with it. I fill the body, sendto and subject of the mail and then I want to open the mail in Lotus Notes Client.
How can I open this mail in the mail client?
This button creates a new mail with content in the To field, Subject field and Body field coming from fields on the XPage (using client-side Javascript). The logic works with whatever defailt mail client you have (IBM Notes, MS Outlook and other mail clients).
<xp:button id="sendMail" label="Send mail">
<xp:eventHandler event="onclick" submit="false">
<xp:this.script><![CDATA[
window.location.href="mailto:" + encodeURIComponent(dojo.byId("#{id:mailTo}").innerHTML) + "?subject=" + encodeURIComponent(dojo.byId("#{id:mailSubject}").innerHTML) + "&body=" + encodeURIComponent(dojo.byId("#{id:mailBody}").innerHTML);
]]></xp:this.script>
</xp:eventHandler>
</xp:button>
I've solved it this way: - Click on a button to create the SendTo, Subject and HTML-Body of the Mail - Then a new XPage opens containing the contents of the Mail - I can edit them now or just click on a button "Send Mail" - Using the SSJS code from Mark Leusink I then send the HTML Mail
var mail = new HTMLMail();
mail.setTo( docMail.getItemValue("SendTo") );
mail.setSubject( docMail.getItemValue("Subject") );
mail.addHTML( docMail.getItemValue("dBody") );
mail.send();
The advantage in this case is, that I can save the mail in the database and not in the mail file of the current user.