Announcement

Collapse
No announcement yet.

Data Strings and URL's

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Data Strings and URL's

    How do you embed a URL in a data string? I've been "Binging" - we're no longer allowed to use Google ... to try and figure this out and I'm not asking the question correctly apparently because I haven't come across anything useful.

    Here's what I am trying to do: we want to send an email to our clients notifying them that their billing is available online and we want to send them the link to our website. I have everything else working but the email (I've got the sending of an HTML email taken care of) I just can't get URL in the command string correctly because of the &#$&#$&#$&#$ double quote around the URL and I've checked with our web programmer ... they need to be there.

    The CEO is asking if this is done daily .... so any help is greatly appreciated.

    Thanks!
    Roxie

  • #2
    Re: Data Strings and URL's

    Hi Roxie:

    Check out this article with code:
    http://www.mcpressonline.com/program...-programs.html

    Best of Luck
    GLS

    < e d i t > I just re-read your origional post .... probably not the proper response.....Sorry GLS < / e d i t >
    Last edited by GLS400; August 1, 2013, 02:31 PM.
    The problem with quotes on the internet is that it is hard to verify their authenticity.....Abraham Lincoln

    Comment


    • #3
      Re: Data Strings and URL's

      Not really sure what you are asking here..? I don't know how you're going about writing the e-mail, but... why would a double quote be a problem?

      Can you provide some more context? Maybe a sample of the code that's failing?

      Comment


      • #4
        Re: Data Strings and URL's

        @GLS - Not a problem... I was just hoping I'd get an answer from someone.

        @scott -- I don't understand why I'm getting the error...and I'll post a copy of the error here and I'll post the code. It may take me a few minutes to get everything posted but I'll get it out here. I just got notified of a production issue so I have to address that and then I'll get everything posted.

        Thanks
        Roxie

        Comment


        • #5
          Re: Data Strings and URL's

          Okay here's the file layout and the subroutine that sends the email. I've been dealing with issues all morning .... you just gotta love software conversions.


          Okay - here's what the file INVEMLCTLP contains (I hope this displays correctly)... Where I have the bolding .. those are the fields from the file.

          PHP Code:
             [B]Email Subject  [/B]Your Trans American Customs Services Statement is Ready                   [B]Email Salute  [/B]Dear                      
             
          [BEmail Body 1[/B]  Your current Trans American Customs Services billing statement is now available for online viewingClick here to 
          log into your account
          : < html> < a href="http://tacustoms.com/Login.aspx?ReturnUrl=/TransTrak/"></a> </html>  You can conventiently 
          view your billing statement from the e
          -Bill link on the Transtrak Main Menu.                                                        
                                                                                                                                              
                                                                                                                                              
                                                                                                                                              
                                                                                                                                              
                                                                                                                                              
                 [
          B]From Name  [/B]TA Billing Department                                                                                             
                
          [B]From Email  [/B]billing@tacustoms.com                                                           [B]Source[/B]  WEB 
          And thank you for your help....

          Roxann
          Attached Files

          Comment


          • #6
            Re: Data Strings and URL's

            Okay it's something to do with my code because if I just prompt the SNDHTMLEML command from the command line and manually type everything in -- I get the email with no problem (other than the HTML tags appear in the code). So now to look at my code...

            Comment


            • #7
              Re: Data Strings and URL's

              When I debug my program this is what I see in the variable Commandline:

              Click image for larger version

Name:	Commandline.jpg
Views:	1
Size:	134.5 KB
ID:	126691


              And this is what I get for an error message:

              Click image for larger version

Name:	ErrorMessage.jpg
Views:	1
Size:	27.8 KB
ID:	126692


              Roxann

              Comment


              • #8
                Re: Data Strings and URL's

                I'm guessing you need some quotes... for example in the string that is the SUBJECT and also the string that is the HTMLMSG.

                When you do the command yourself from the command line, it's working. And if you look to see the command string that was created, there will probably be quotes around the subject and email body text. If so, you need to format the string the same way and include the quotes.

                So in your RPG, use three quotes instead of one in order to get the quote included... like SUBJECT(''' and HTMLMSG('''

                As an example, here is some code from one of my RPG programs that is working:

                Code:
                         emailCMD = 'GUMBOMAIL/GSENDMAIL TOSMTPNAME((' +
                                    %trim(emailAddress) + ')) SUBJECT(''' +
                                    %trim(emailSubject) + ''') MSG(''' + %trim(emailMsg) +
                                    ''' *TEXTHTML) BCC((john.doe@mycompany.com)) +
                                    FROM(notification@mycompany.com)';
                
                         success = system(%trim(emailCMD));
                Last edited by Viking; August 2, 2013, 01:11 PM.

                Comment


                • #9
                  Re: Data Strings and URL's

                  @Viking - You just made me smack my head.... I put three, four days in working on getting the SNDHTMLEML process working from off the internet. We have GUMBOMAIL ...but I couldn't figure out how to get it to send HTML emails .... thanks for sharing that, and I'll try the extra quote to see if that solves my problem.

                  Roxann

                  Comment


                  • #10
                    Re: Data Strings and URL's

                    I agree with Viking... strings passed to a CL command need to be enclosed in single quotes, and anywhere that you have single quotes in the data of your string need to be doubled. Perhaps an easier/better way to do this is to create a CL module and pass the data as variables instead of creating a big literal string and passing it via QCMDEXC.

                    Also -- you should make your entire message HTML, instead of trying to make a portion of it be plain text and a portion of it be html. The way you're doing it may sometimes work in some e-mail clients, but is not standards compliant and may not work everywhere.

                    Since the command is called SNDHTMLEML, I assume that it always sets the mime-type to text/html, so you shouldn't send anything else aside from the html... just make it all one html document.

                    Comment


                    • #11
                      Re: Data Strings and URL's

                      Scott - Thanks for reviewing. When I posted the code earlier I thought to myself "you should have stuck with your first idea and made this a CL processs that you pass the values to" but I thought I was being slick. Pays for thinking these days... And I had justcome to the conclusion that the entire email body needed to be HTML and not just a small portion and then when Viking posted the example using Gumbomail I wanted to beat my head against the wall. We have Gumbomail ... we just don't currently have the ability to send HTML emails because the software is out of date. So guess what I'm doing next week ... I'm updating Gumbomail so I can send our clients nice HTML emails telling them that their bill is ready.

                      Much thanks to all for the help.

                      Roxann

                      Comment


                      • #12
                        Re: Data Strings and URL's

                        Yes, a CL is an easy way to simplify this kind of thing, but if I can easily do something in RPG without needing to write an additional CL, then I do. I find myself writing less and less CLs these days.

                        Btw, I just did a little test and am able to include a clickable URL in the string when I build the string that is used for the emailMsg by just including "http://www.google.com" in the text. So the single quotes are definitely the problem you're having, not the URL.

                        Example:
                        Code:
                            emailMsg = 'Hello ' + %trim(emailName) + ',' +                        
                                       '<br><br>Blah blah blah. +             
                                        <br><br>Thank you. +                                   
                                        <br><br>If you have any questions, please +            
                                        click here: +              
                                        <br><br> "http://www.google.com" ';
                        p.s. You have a misspelling in your message... "conveniently"
                        Last edited by Viking; August 2, 2013, 02:01 PM.

                        Comment


                        • #13
                          Re: Data Strings and URL's

                          @Viking - I just figured that out about the URL -- I've been "playing" to see what would work and discovered that I didn't need to do all that I was doing so now I'm just trying to "clean it up" so the CEO is happy. And thanks for the spelling tip - I saw that and just hung my head. I usually catch my spelling mistakes but not today .... it's been a long one and I am looking forward to 5 PM. And I took a look at our GumboMail updates -- I have two to install so I can send HTML emails -- so you know I'll be working on them next week.

                          Thanks for the help!
                          Roxann

                          Comment

                          Working...
                          X