Link to home
Start Free TrialLog in
Avatar of westermo
westermo

asked on

Carriage Return needed in body of VBSCRIPT generated e-mail message

Hi Experts, I am using a Data Access Page with a button to generate a mail message and populate the TO, SUBJECT and BODY areas.  The code below works fine, but I need to ammend it in some way that will include the [Contact_Name] field on a new line (carriage return) under the [Company_Name].

This is what I have sof far:

------------------
window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value
------------------

Which displays the following in a new message, ready for the user to click the 'Send' button:

------------------
To:  Sales Staff Name
Subject: Technical Support Ref: 1234

Message Body:
Company Name: Bloggs & Co
------------------

I would like to display the [Contact_Name] on the next line e.g.

Company Name: Bloggs & Co
Contact Name: Joe Bloggs

Please help.....

Avatar of rockiroads
rockiroads
Flag of United States of America image

hello again, lets hope they dont change the design again eh, lol


In vb you would add VBCRLF or VBCR


window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value & vbcrlf & "XXXX"

this would add XXXX on a new line

try it in this
Avatar of westermo
westermo

ASKER

Hi rockiroads !!

Would have been a perfect quick solution BUT.... it doesn't work :(  Neither vbcr or vbcrlf made any difference - not even an error message.  Funnily enough I can replace either with any text and it's just ignored.

Thanks tho, Any other ideas?
is it possible to output this?

\r\n

Syntax error shows when using \r\n as follows

window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Westermo UK Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value & \r\n & "dummy text"
should be:

window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Westermo UK Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value & "\r\n" & "dummy text"
\r\n is a string, like Arthur has done, it has to go into quotes,

Im not sure if it will work, but give it a shot
Thanks and sorry guys, because its surrounded by quotes, it displays in the body message as follows:

Company Name: Bloggs & Co\r\ndummy text

ASKER CERTIFIED SOLUTION
Avatar of dssdb
dssdb

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
is it possible to define a string first

x = "..." & vbcrlf & "..."

window.open ... & x

Maybe this ?

window.open "mailto:" & DropDownList_Sales_Staff.value & "?subject=" & "Westermo UK Technical Support Ref:  " & ID.value & "&Body=" & "Company Name: " & Company_Name.value & chr(13) & chr(10) & "Contact name etc"
Hey guys  Thanks for all your help.  Colleagues of mine tried the chr 10 and 13 but these were also ignored.

:D  dssdb has hit the nail on the head with this one with his advice as follows:

"%0D%0A"

This works a treat - so it's only fair I give him the points - hope you all agree.  Many thanks to ALL of you.  Until next time rockiroads :D I'm sure....

Thanks again
cheers.. %0D%0A worked a treat... the ms knowlege base lies i tel ya!! they suggest using Line1%250dLine2 but that just comes up with Line1%0dLine2