Skip to main content
Question

How do I create a button to initiate an email from Outlook?

  • August 31, 2013
  • 0 replies
  • 577 views

I would like to create a button to add to a form that would initiate a standard email from Outlook to another QB user. The email should send a copy of, or a link to, the record being displayed in the form when the button is clicked. Is this possible?
This topic has been closed for replies.

Forum|alt.badge.img+6
  • Registered
  • August 31, 2013
This is an example of a URL formula field to invoke the user's default mail client.  The are some lines commented out that would turn it into a formula-text field as an href type link.  But in the new UX when you click those on a report the record also opens up, which is most confusing to users.

... Anyways, here is an example.  You should URLEncode anything from a field that might have spaces or special characters.


//"<a href=\

"MailTo:customerservice@gesco.ca"

// the above text invokes the mail client, and creates the TO line

&"?subject=Quick Specials Order"

// the above text does the subject line, below that is the body
// the %0A is a line feed type indicator.

&"&body=Attention SHNIER Customer Service, please order the following for me "
&"%0A%0A"&[Specials List Category - Accessories Group]


&"%0A"& URLEncode([Description])

&"%0A"&"Item Code: " & URLEncode([ITEM#])
&"%0A" & "Price is " & URLEncode([Price & Comment])
& If([Cuts OK?]="OK", " (Price is $1.25 extra for cuts)")
& If([Rolls Only?], " (no cuts allowed on this item)")

&"%0A%0A" & "Qty is " & [Qty Available]  & " U/M is "  & [UM] & "  (Edit Qty as necessary)"

&"%0A%0A" & "My Store name is :"
&"%0A%0A" & "My Tel number is :"
&"%0A%0A" & "My name is :"
&"%0A%0A" & "My Purchase Order is:"
&"%0A%0A" & "My Ship date is:"
&"%0A%0A" & "Special Instructions:"

// OK the URLEncode function is required because putting certain special
// characters into the HTML messed it up.  So, since you can't directly
// put an = or & into the string, you need to use the URLEncode function.

&"%0A%0A" & "(Internal use information follows)"
&"%0A" & "Locn: " & URLEncode([Location])
&"%0A" & "Serial: " & URLEncode([Serial#])
&"%0A" & "Shade: " & URLEncode([Shade])

&"%0A%0A" & "Here is a Query for the Item in Quick Specials"

&"%0A" &"https://gesco.quickbase.com/db/xxxxxxxx?a";
& URLEncode("=")& "q" & URLEncode("&") & "qid"
& URLEncode("=") & "65" & URLEncode("&") & "nv"
& URLEncode("=")  & "1" & URLEncode("&")
& "v0"& URLEncode("=") & "Item" & URLEncode([ITEM#])

 
// This last bit creates the words for the link that you click.

//&"\">"&"<b>Order by Email"&"</a>"

  • Author
  • Registered
  • September 10, 2013
Thank you very much! Was able to figure out 97% of what I need to do :)

Two remaining questions:
1. Is it possible to have QuickBase look at my Program Manager field to get the "To" info for the email?

2. What do I put at the end of the sentence below to create a link back to the record from which the email was initiated?
Please contact me about this record: (this is where I'd like to have a link back to the record)

Thank you again!

Forum|alt.badge.img+6
  • Registered
  • September 10, 2013
no problem

Create a Formula email field [Program manager email] with the formula UsertoEmail([program manager]) and include that in the Mailto like

"MailTo:" & URLEncode([Program manager email])

I'm not sure if you need to URLEncode it, but it shouldn't hurt just in case the @ in email addresses is an illegal character.

As for the last part you should be able to simply have a line like

&"%0A%0A" & "Please contact me about this record "
& URLEncode (URLRoot() & "db/" & dbid() & "?a=dr&rid=" & [record ID#])

  • Author
  • Registered
  • September 10, 2013
THANK YOU, THANK YOU, THANK YOU!!!
That did it! :)

  • Registered
  • November 21, 2014
Mark,
how do i embed a form in the email i'm generating? i understand how to embed the form (showing the buttons and fields) in a regular QB notification, but what about this notification that's being generated directly in Outlook?

i've created the button to allow people to "Approve" or "Reject" and tried using the API_Authenticate but i'll have to work on that some more because i'm getting errors. How do i make the hyperlink display in a button like it does within QB???

I do not know of a way to send anything other than basic text in a MAILTO: button.  I do not claim to be an expert in MAILTO formatting, but I'm under the belief that the MAILTO is like the lowest common denominator for causing an unknown random "Mail client" to pop up a window.  It could end up being Outlook or a gmail webmail screen or whatever the default mail client is for the random user who clicks that link.  Since the mailto does not know who will be clicking it, its very basic.

My suggestion is to reconsidering using the built in email Notifications and giving the user a way to specify the email addresses and to manually trigger the email.

  • Registered
  • December 4, 2014
how do i add an address to the "CC" line? i've tried this:
"MailTo:name@domain.com?cc=othername@domain.com"&
"?subject=test email"

which results in "name@domain.com" going into the "To:" line as needed, but everything else goes into the "cc" line (including the ? before subject=test email.

Se if this helps.  its just a random google on "mailto syntax", but  think it has your answer. http://www.labnol.org/internet/email/learn-mailto-syntax/6748/

  • Registered
  • December 4, 2014
that's a good one, but it doesn't help me with the error i'm getting in the QB formula button.

even when i type:
MailTo:name@domain.com?cc=othername@domain.com?subject=subjectline
in the browser it generates an email that looks like this:

To... name@domain.com
Cc... othername@domain.com?subject=subjectline


i must be missing something between the "othername@domain.com" and the "?subject=..." pieces.

I played with it and I think that the issue is that there can only be on "?"  Typically the ? means " and here are all the parameters.
try this


"<a href=\"MailTo:"&[Emails for carrier and others separated by semi colons]

// the above text invokes the mail client, and creates the TO line

& "?cc=test@test.com"

&"&subject="
&[Carrier Subject Line] & " for Trailer " &

// the above text does the subject line, below that is the body
// the %0A is a line feed type indicator.

& "&body=" &[Carrier Body Header]

  • Registered
  • December 4, 2014
fantastic. i started copying and pasting like a crazy man and randomly discovered that if i only put the ? before the "cc" and then used "&" for each line of stuff it worked.

thanks so much for your help on this one. i didn't know what the ? meant, but now i do and it makes much more sense.

Its actually similar to quickbase urls, they define a path and then they always have a  ? and the rest is parameters telling it what ti do.

  • Registered
  • December 15, 2014
how do i make QB return to the record after initiating the MailTo fuction?
when i'm editing the record i click the button and i'm advised to save my record first. Outlook opens correctly, but my QB form goes to a blank page.

Can you post your current formula?

  • Registered
  • December 16, 2014
"MailTo:user1@domain.com"

&"?cc=user2@domain.com; user3@domain.com; user4@domain.com"


&"&subject=Subject - "&[field name] &" - Site #: "&URLEncode([Site #])&" - Site Name: "&URLEncode([Site Name])

&"&body=user1,"&"%0A%0A"&
"Please send package for this site to:"&"%0A%0A"
&[Address]

not tested, but try this.

var text URLONE = "MailTo:user1@domain.com"
&"?cc=user2@domain.com; user3@domain.com; user4@domain.com"
&"&subject=Subject - "&[field name] &" - Site #: "&URLEncode([Site #])&" - Site Name: "&URLEncode([Site Name])
&"&body=user1,"&"%0A%0A"&
"Please send package for this site to:"&"%0A%0A"
&[Address];

var text URLTWO =
urlroot() & "db/" & dbid() & "?a=dr&rid=" & totext([record id#]);

$URLONE & "&rdr=" & URLEncode($URLTWO)

Is it possible to embed a table of child records when creating an email like this?

No. I don�t think so.