Page 1 of 1

Getting Download Link from Email Body

Posted: Mon Oct 26, 2015 3:41 pm
by John.M.Dean
Greetings,

I am trying to pluck a download link from email bodies. Using the HTTP request configurator gets me almost there. The flow works as expected if I explicitly use the link. That is to say, it gets the PDF files I need with no issues, so that mechanic is working fine. However, I need to get a different link from each email. I can use defined variables something like:

https://www.shswelcomecard.com/ShowPDF.asp?order=[Email.Body:After=".asp?order=",Before="&"]&imp=1&accesscode=[Email.Body:After="accesscode="]

The problem is that I am so far unable to define where the link ends in the email. Placing regex searches in the Switch variable generates some issues. I've tried counting the access code characters as well. The last characters are the end of an HTML tag something like:

<td width="500" colspan="2"><a href="https://www.shswelcomecard.com/ShowPDF. ... 720">Click for Combined Imposition File</a><br>

Can this be done more simply with Switch out of the box or will I have to write some scripting to discover this link address?
Thank you.

Re: Getting Download Link from Email Body

Posted: Mon Oct 26, 2015 6:21 pm
by gabrielp
Can you modify the email body? If so, I feel like you can get there by adding some HTML attributes which would allow you to more easily grab them with the method you're using now.

Perhaps:

Code: Select all

<td width="500" colspan="2"><a data-start-parse="1" href="https://www.shswelcomecard.com/ShowPDF.asp?order=60543&imp=1&accesscode=C9F05F1F-AE70-4054-9B6D-CA4E13DEB720" data-end-parse="1">Click for Combined Imposition File</a><br>
There's probably a better way of doing it though.

Re: Getting Download Link from Email Body

Posted: Mon Oct 26, 2015 6:30 pm
by John.M.Dean
I've got it working by allowing the Mail Receive to convert the email to text (vs HTML). I'll need to get further down the flow process to see if that will trip me up later. But for now, it's good. Removing the HTML tags took care of it.

Thanks.

Here's the URL path that's doing the trick:
https://www.shswelcomecard.com/ShowPDF.asp?order=[Email.Body:After="PDF.asp?order=",Before=">"]