URL link as Image in Email?

  • 0
  • 1
  • Question
  • Updated 4 months ago
  • Answered
I am trying to figure out how to show an image or at least change the text shown of a URL link that gets put into an email. Basically, I have a "Send for Approval" button on a form that automatically generates an email with the recipient, subject, and body filled in using "mailto:" and I put an "Approval" URL link in there that uses my authentication information to sign in and change three separate fields in the form then automatically logs out and redirects to the logged out page. So far, this is working, except, I don't want the link to show. I want either text that says, "Approve this job" or some image over it that has the hyperlink, and I would rather not use the email notification feature for this, considering I would like the "From" in the email be the user who clicked the button and we already use this button minus the "Approve" link in the email. The approver right now has to send a reply back saying it has been approved then the user has to go back into quickbase and change the three fields him/herself.

All of this was done in steps, so each part of what this "Send for Approval" button does has been done incrementally as I figured out how to do each thing. Everything works except for the image/text for link replacement, but I figure I need to post all the code involved in the process, so, right now, I have three fields to try to accomplish this:

/Send for Approval
            (the main button on the form and uses "/ApproveImage" as the link)
/Approve in email
            (accomplishes the approval part of signing in, changing three fields, and logging out)
/ApproveImage
            (tried using this field with html code using <href> and <img>, but it is still showing link.)

Here is my code:

/Send for Approval
=========================================================================

var text URLONE = "MailTo:someone@someplace.com"
//&"?cc=user2@domain.com; user3@domain.com; user4@domain.com"
&"&subject=WR for Approval"
&"&body=WR "&[WR #] &" is ready for approval."&"%0A%0A" &"Below is the download link for the sketch:" & "%0A" & 
If(
[Updated Sketch]="",
"h ttps://pike.quickbase.com/up/"; & Dbid() & "/a/r" & [Record ID#] & "/e71/v0",
"h ttps://pike.quickbase.com/up/"; & Dbid() & "/a/r" & [Record ID#] & "/e91/v0"

)
& "%0A%0A"  & "To approve this job, click the link below:" & "%0A" & URLEncode([/ApproveImage])
;

$URLONE

=========================================================================


/Approve in email
=========================================================================
var text URLONE = "h t t p s://pike.quickbase.com/db/main?act=API_Authenticate&username=me@someplace.com&password=mypassword";
var text URLTWO = "h ttps://pike.quickbase.com/db/bmwn5ta2x";

& "?act=API_EditRecord&key=" & [WR #]

& "&_fid_77=" & ToText(Today()) 
& "&_fid_15=" & ToText(50)
& "&_fid_76=" & ToText("Name of Approver")
& "&_fid_136=" & true
&"&apptoken=****************************";

var text URLTHREE = "h ttps://pike.quickbase.com/db/main?a=API_SignOut";
var text URLFOUR = "h ttps://pike.quickbase.com/db/main?a=LogoutConfirm";
$URLONE
&
"&rdr=" & URLEncode($URLTWO) &
URLEncode("&rdr=" & URLEncode($URLTHREE)) &
URLEncode(URLEncode("&rdr=" & URLEncode($URLFOUR)))
=========================================================================


/ApproveImage
=========================================================================
"<a href=\"" & [/Approve in email]&"&\">"&
"<img src=\"h ttps://openclipart.org/download/312459/1545571884.svg\"></a"

//"<a href="&[/Approve in email]&">"&
//"<img src=\"h ttps://openclipart.org/download/312459/1545571884.svg\"></a>"
=========================================================================

In the /ApproveImage code, I have tried both of the instances of href/img and they just show the massive link and no image.

I appreciate any help on this!
Photo of Jordan McAlister

Jordan McAlister

  • 790 Points 500 badge 2x thumb

Posted 4 months ago

  • 0
  • 1
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,448 Points 50k badge 2x thumb
I have not tested this in a mail to command b ut here is a generic format of a hyperlink

var text Words= "Your words go here";
var text URL = "Your URL goes here";

"<a href=" & $URL & ">" & $Words & "</a>"
Let me know if that works in a mailto:
Photo of Jordan McAlister

Jordan McAlister

  • 790 Points 500 badge 2x thumb
It didn't work; it just shows <a href=".......url...../a>.  I am using a "Formula - Text" field for the /ApproveImage. Should I be using Rich Text field?

Here is my update code for /ApproveImage:
============================================================================
var text Words= "Approve Job";
var text URL = [/Approve in email];


"<a href=" & $URL & ">" & $Words & "</a>"
============================================================================
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,448 Points 50k badge 2x thumb
Can you tell me what your email client is?  outlook?  Gmail?  what email program do you use?

Photo of Jordan McAlister

Jordan McAlister

  • 790 Points 500 badge 2x thumb
outlook

Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,448 Points 50k badge 2x thumb
is there a button in your Outlook to change the screen to Rich Text  under 

"format text"


Photo of Jordan McAlister

Jordan McAlister

  • 790 Points 500 badge 2x thumb
yes, it gives me "html, plain text, and rich text." There is also, in option - under Mail, a place where I can choose the same options when composing messages.

Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,448 Points 50k badge 2x thumb
As I have not tested, does that change the result if you select those other options.
Photo of Jordan McAlister

Jordan McAlister

  • 790 Points 500 badge 2x thumb
it does not, I tried while in the compose message editor then I even tried changing it in options and restarted outlook and still nothing.
Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,448 Points 50k badge 2x thumb
I will have to find time to play with it myself when I get a chance see if I can coax into Rich text.


Photo of QuickBaseCoach App Dev./Training

QuickBaseCoach App Dev./Training, Champion

  • 67,448 Points 50k badge 2x thumb
... I don't know how to get a hyperlink embedded in a mailto URL.  Based on this thread below, it sounds not so easy or reliable.

https://stackoverflow.com/questions/247245/is-it-possible-to-add-an-html-link-in-the-body-of-a-mailt...
Photo of Ⲇanom the ultimate (Dan Diebolt)

Ⲇanom the ultimate (Dan Diebolt), Champion

  • 30,074 Points 20k badge 2x thumb
As the SO thread states the mailto protocol does not support HTML although there is a possibility that upon receipt some email clients may convert text that appears to be a URL into a clickable link. This behavior is entirely dependent on the email client of the receiving user.

Using script you can hijack the action main?a=userwin to send HTML as suggested by these two screenshots:



Received email:



This code should accomplish the same thing:
$.post("main?a=UserWin", {
  uids: "1084879.bdbt",
  subject: "Important Message",
  message: "<a href='https://help.quickbase.com/api-guide/intro.html'>QB API</a>",
  send: "send"
}).then(function() {
  console.log("email sent");
});

Photo of Jordan McAlister

Jordan McAlister

  • 790 Points 500 badge 2x thumb
i will look into this, thanks!