Discussions

Expand all | Collapse all

URL link as Image in Email?

  • 1.  URL link as Image in Email?

    Posted 01-14-2019 14:39
    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!


  • 2.  RE: URL link as Image in Email?

    Posted 01-14-2019 15:31
    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:


  • 3.  RE: URL link as Image in Email?

    Posted 01-14-2019 17:06
    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>"
    ============================================================================


  • 4.  RE: URL link as Image in Email?

    Posted 01-14-2019 17:19
    Can you tell me what your email client is?  outlook?  Gmail?  what email program do you use?



  • 5.  RE: URL link as Image in Email?

    Posted 01-14-2019 17:21
    outlook



  • 6.  RE: URL link as Image in Email?

    Posted 01-14-2019 17:26
    is there a button in your Outlook to change the screen to Rich Text  under 

    "format text"




  • 7.  RE: URL link as Image in Email?

    Posted 01-14-2019 17:34
    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.



  • 8.  RE: URL link as Image in Email?

    Posted 01-14-2019 17:35
    As I have not tested, does that change the result if you select those other options.


  • 9.  RE: URL link as Image in Email?

    Posted 01-14-2019 17:40
    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.


  • 10.  RE: URL link as Image in Email?

    Posted 01-14-2019 17:42
    I will have to find time to play with it myself when I get a chance see if I can coax into Rich text.




  • 11.  RE: URL link as Image in Email?



  • 12.  RE: URL link as Image in Email?

    Top
    Contributor
    Posted 01-15-2019 11:11
    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">https://help.quickbase.com/api-guide/intro.html'>QB">https://help.quickbase.com/api-guide/intro.html'>QB API</a>",
      send: "send"
    }).then(function() {
      console.log("email sent");
    });



  • 13.  RE: URL link as Image in Email?

    Posted 01-15-2019 13:16
    i will look into this, thanks!