How to extract the url from an embedded link in an email - lotus-notes

I've got an email processing agent. It copies the body of the email into a document's rich text field. If there are any embedded links in the email I want to process that embedded link and extract the url. I started playing around with MIMEEntity but nothing came of it. Any ideas?
thanks
clem
================
Hi Rich,
Well here's a more robust explanation of what's going on. I have several Notes apps which deal with email correspondence. An email comes in, a Notes document is created with some meta data (system generated ID, user's email, name, company, status, etc). The email body is added to a 'correspondence' rich text field of the created Notes doc. The app allows for someone on our side to follow up on the email (ask a question, provide some feedback, etc). That response from us is pre-pended to the original email. If the original sender responds with some further information, THAT email is also pre-pended. To do this pre-pending, I do
bodyText = EmailDoc.GetFirstItem("Body").text
textFromNotesDoc = CTdoc.GetFirstItem("Issue").text
newTextFromNotesDoc = bodyText + <some stuff> + textFromNotesDoc
I then do a replace.
This worked perfectly fine for years. However, recently users have been sending in emails containing embedded links. Of course anything like that is lost when I do the NotesDocument.GetFirstItem().Text. So I've been trying to think of a way to capture the embedded link. The other day it occurred to me that if I could read the html, I could find and extract the url and simply add it to text. I thought maybe using NotesMIMEEntity would allow me to read through the body field and find the url but that's not working.
Clem

The solution is to NOT NotesDocument.GetFirstItem().Text. Just simply take the email coming in and prepend the body field to the discussion RT field. I add tags to the email going out so that I know if the person responding included the previous conversation. That took a little work to figure out but by using NotesRichTextNavigator and related classes, I'm able to deal with that.
clem

Related

How can I send an entire Notes document with attachments and many RT fields via email to Outlook?

We have an old client application from which users want to be able to send individual documents (many fields, many of them rich text with and without attachments in each) via email to people without Notes clients (or access to Notes). I am able to generate the email and include the attachments, but the body of the email is plain text and the form is very long, so it's line after line of appendText to grab the field data to include in the email. It's ugly! Is there any other way to go about this? Looking for other ideas. Thank you!
Your best bet is probably to write code that creates a new mail message, accesses the document you want to send, and use the NotesDocument.RenderToRTItem method to include the visible contents of that document in the new message.

Kentico 11 - Macro's not working in Marketing Emails

I have just started to use Kentico, so far everything has been straight-forward however I cannot get certain Macro's to work in Marketing Emails (to insert personalized information in the email such as their country).
Here is a quick overview of my automation process
Person submits a form on the website
Form field information gets mapped to the contact
Automation process begins
Internal/Transactional email sent which contains the requesters information (Macro's work)
Marketing email sent to requester, containing relevant information (Only basic Macro's work (for example recipient.firstname))
The issue is that the Macro's that are used (and working) in the internal transactional email do not appear to work in the marketing emails section, for example: {% OnlineMarketingContext.CurrentContact.ContactCountry #%} would copy in the requesters Country in the transactional/internal email, but it remains blank in marketing emails (Note: I have tested this fully, not as a draft email as I've read that the information doesn't get passed in a draft email).
I have tried using different objects (ContactManagementContext, etc.), however nothing appears to bring in personalized information.
Is there something I need to do to get the Macro's working within the Marketing Emails section? I have read through the docs online and I can't find anything to make this work.
Any help would be greatly appreciated.
The newsletter email macros are based off the subscriber not the contact. If you want to use the contact info, you will have to find a way to relate the subscriber to the contact.
This video shows how to see what macros are available.
Zach is correct. Normally, you would lookup the Contact based on the email address of the Recipient, e.g. {%GlobalObjects.Contacts.Where("ContactEmail = '"+Recipient.Email+"'").TopN(1).FirstItem%}. However, there is a hidden object you can use in marketing emails: {%Advanced.ContactInfo%}

How does a Gmail message Id or ThreadId map to the new Gmail UI?

Edit: addressing the first comment below and for clarity, this isn't a code question. The question is simply:
What do I put into the URI querystring of the new Gmail UI to view a draft message created by the Gmail API?
Despite this not really being a code question, I'm asking on Stack Overflow as it's Google's preferred platform for Gmail API questions.
--
If I view a draft message in the new Gmail UI, the URI is something like this:
https://mail.google.com/mail/u/1/?zx=iij9apqgzdf4#drafts?compose=jrjtXSqXwlFGnSGCQgDCdnHGVFdlpFMgzsCNgpQstQLxdLCMkjKstBmWZkCmjhWTQnpsZCJF
I can't see any way to create such a link from the Id or ThreadId of a message created via the Gmail API.
Previously, one could do this:
https://mail.google.com/mail/u/1/?zx=ov61dxfbrcga#drafts?compose=1631caae9dbb074d
where the value of "compose" is the Id.
How can the same thing be accomplished in the new UI?
I've been encountering the same problem and have had some success in this problem, as well as some issues I still can't get past.
Good news: The new compose parameter format is some kind of "base40" encoding. I searched the Gmail source for a restricted alphabet string, and found and deobfuscated the bit of code doing this encoding/decoding: https://gist.github.com/danrouse/52212f0de2fbfe33cfc56583f20ccb74
This code includes an encode and decode function which should work for Gmail-format query parameters.
Bad news: The values that it is encoding to open draft emails do not appear to be available using the Gmail API. Specifically, they look like this:
thread-f:NEW_THREAD_ID+msg-a:DRAFT_ID -- while the draft ID is the same as it was before, the Thread ID does not appear to match any of the IDs that the Gmail API returns.
Interestingly, if you inspect the subject row in the Gmail UI, it has dataset attributes including all of both the old format and new format IDs - but it's still unclear how to get the new ones programatically.
Thanks to #frank-szilinski - he pointed out that the old format is now translated. I.e. this now works again:
https://mail.google.com/mail/ca/u/1/#drafts/1661237c4db71ace
It doesn't seem to work when the Gmail tab isn't already open, however.
Building on #kremonte gist, and #chris-wood comments, I made a rails gem that correctly creates the open-the-draft-inside-gmail URL.
It's here - https://github.com/GoodMeasuresLLC/gmail_compose_encoder
It's for the use case of "my code created a draft (prepopulated with some text, of course) and now I want to open the draft in compose mode so that my user can review it before hitting "send".
How to get the URL for a draft
If, for example you use a list request from which you get your draft objects:
{
"id": string,
"message": {
object (Message)
}
}
You can take this id and put it into a URL in this format:
mail.google.com/mail/#inbox?compose=[id]
Eg.
mail.google.com/mail/#inbox?compose=3doinm3d08932d
This will open up GMail with the relevant draft open.
I was struggling because I wanted it to work with multiple accounts. However the authuser parameter did not help.
Inserting the email address instead of the integer after the u/ component solved the problem.
https://mail.google.com/mail/u/{email_address}/#drafts?compose={message_id}
The message id is the one provided by the API.

Custom memo field isn't copied to Reply or Forward in Lotus Notes 6.5

I work in a development/support team which has a shared Lotus Notes mailbox. We need to be able to associate an issue ID with each email. We started by adding this ID to the subject line (eg. "Something doesn't work [ID12345]"). For performance reasons, our IT dept don't allow indexing of shared mailboxes, so it takes a long time to search for a particular ID.
I decided to add a new ID field, which can be shown as a sortable column in views and folders. I put this field to the visible header (just below 'Subject') in the ($All) view and the ($Inbox) folder, and copied the ($Inbox) design to all the other folders in the database. That much was easy.
My problem is that when we reply or forward, this custom field is not carried over to the new memo, so we have to manually add it again before sending. And of course when the user responds, the field is again missing and must be manually added. I have searched the docs and the internet and haven't found any information on this. Either I have to declare this field as something which persists across replies and forwards, or I have to add a line somewhere which explicitly copies the field contents to the new memo.
fsw,
We do exactly this with our complaint system however our database is indexed although this should not be an issue to you. We created a view that is sorted by ID by extracting just the ID from the subject line, order it by ID and then by date descending. Base it on the $ALL folder view so you get both incoming and sent emails.
We then altered the memo form to include an embedded view single category of the new view that sits above the body which shows all other documents linked to the ticket.
This should avoid having to delve to far into the very complex mail template any further. One thing is to make sure you have a copy of the changes you made and a bit of doco re deploying as you can guarantee that one day your template will be completely overwritten in an upgrade and all your good work will be gone.
As the additional field would have to incorporated into all Memo forms in mail templates in your corporation and as these fields do not easily travel via SMTP, you should stick with the ID in the subject.
What you could do is to parse the subject (#Mid, #Right, ...) in the column formula in the view and only display the ID there (like you did with the additional field).
The other option I envision if having a field is required is to have an agent that processes the incoming message(reply) to have it parse out the issue ID from the subject and write it to the field. You could also do that with queryopen or postopen if running an agent is not possible

WATIR: how do drive outlook web access

since the emails loads dynamically how do you find a specific email that contains a button back to your site. This is like signing up at a site. Customer receives email to confirm.
Thanks for the support
BigD
OWA, bless MS's little hearts (at least in the circa 2003 version I'm looking at here) uses frames, so first of all brush up on that or you are gonna be hating life. The list of incoming messages is in a frame named 'viewer' The message summaries are contained in a table lacking any useful means to identify it that is in a div of class 'msgViewerCont" and an ID of dvContents. So to see if a message exists you want to look to see if you can find a row in that table which contains the subject you expect to see.
(be careful using ID values on OWA.. apparently nobody in the group that developed it read the part of the HTML standard that specifies that ID values are supposed to be unique.. the re-use them all over that page.)
Presuming you know the subject of the message you are about to receive, and also that you keep that mail account cleared out so that it will be the ONLY message there with that subject line, then you can check to see if it exists usng
subject = regex.new("subject you are looking for")
browser.frame(:name, 'viewer').div(:id, dvContents).table(:index, 1).row(:text, subject).exists?
to click on it use .click instead of exists.
once you've clicked it, OWA will refresh the PreviewPane iframe.. inside that iframe is another one that has the message body in it.
all those frames, are nested inside the viewer frame. welcome to nested frame hell. hope you enjoy your stay. (like I said, bone up on frames, you're in for a fun ride)

Resources