Send Variables to Body in Email

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Rainmanal
    Forum Member
    • Jul 2007
    • 6

    Send Variables to Body in Email

    I am trying to use an input box for user input and pass it the body of an email message, I am finding no luck in doing so. Also, is there a way to send a carriage return within the body? I've tried using the "/r/n" option but it just displays /r/n within the message.

    Thanks in advance.
  • Ulrich
    Indigo Rose Staff Member
    • Apr 2005
    • 5137

    #2
    If you simply want to open the e-mail client, you can use the File.OpenEmail for this. Just make a call like in the example below:

    Code:
    File.OpenEmail("[email protected]?subject=Test%20Subject&body=First%20Line%0D%0ASecond%20Line%0D%0AThird%20Line", SW_SHOWNORMAL);
    You have to compose the whole message (recipient, subject and message body) as a single string. You can't use spaces, so replace them with "%20". The line breaks (\n) won't work as well, you have to replace them with "%0D%0A" instead.

    Hope this helps.

    Cheers,
    Ulrich

    Comment

    • Rainmanal
      Forum Member
      • Jul 2007
      • 6

      #3
      Thanks Ulrich, adding the additional lines does help but I was wondering if I can pass variables to the email message.

      For instance, I am using a drop down box and I want to be able to pass the selection into the email. I know how to pass variables but not sure how to do it in the body of an email. It simply comes out as text. Do you know of a way to do it?

      Comment

      • TimeSurfer
        Forum Member
        • Dec 2007
        • 479

        #4
        Why not make a temporary textfile to hold your email body using textfile.writefromstring. you could use /r/n and pass variables to textfile.writefromstring. then just call it back with textfile.readtostring and pass it to your email as you usually would. using this method would allow you email body to have multiple lines.

        hope this helps you

        ch33rs,
        timesurfer

        Comment

        • Rainmanal
          Forum Member
          • Jul 2007
          • 6

          #5
          Thanks TimeSurfer, I'll give that a try

          Comment

          Working...
          X