Discussions

Expand all | Collapse all

Help with creating email syntax

  • 1.  Help with creating email syntax

    Posted 24 days ago
    I have the following code and it works fine, but if I remove the cc: line, it does not work.

    Working Code:

    var text Subject =
    "Subject Text" ;

    var text Body =
    URLEncode("Body Text");

    var text Email = "mailto:Email@email.com" &
    & "?cc=Email@email.com"
    & "&subject=" & URLEncode($Subject)
    & "&body=" & $Body;

    "<a href="
    & $Email
    & ">" & "Create Email" & "</a>"

    However, if I comment out the cc line, it doesn't know the next line is the subject, and then the body. It will just string together the subject and body and treat it like another 'To' email address.

    What syntax am I supposed to add or change when removing the cc? I am using a formula rich text field.

    ------------------------------
    Michael Tamoush
    ------------------------------


  • 2.  RE: Help with creating email syntax

    Posted 24 days ago
    The ? indicates the start of the rest of the parameters after this "mailto:Email@email.com

    so, if you remove that cc line then you need to retain the "?"
    For example 

    var text Email = "mailto:Email@email.com" &
    //& "?cc=Email@email.com"
    & "?subject=" & URLEncode($Subject) // include the ? delimiter here
    & "&body=" & $Body;

    "<a href="
    & $Email
    & ">" & "Create Email" & "</a>"


    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 3.  RE: Help with creating email syntax

    Posted 24 days ago
    I thought that may be the case, but when I try that it simply leaves the subject blank. I tried to simplify and test, but same result. Below results in the to field correct, and the Body correct, but the subject blank.

    vvar text Email = "mailto:email@email.com"
    & "?&subject=test"
    & "&body=Body";

    "<a href="
    & $Email
    & ">" & "Create Email" & "</a>"

    ------------------------------
    Michael Tamoush
    ------------------------------



  • 4.  RE: Help with creating email syntax

    Posted 24 days ago
    & "?subject=test"
    I think you need to get rid of the & before the word subject.


    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------



  • 5.  RE: Help with creating email syntax

    Posted 24 days ago
    Ahh yes of course. And that did the trick!

    ------------------------------
    Michael Tamoush
    ------------------------------