Solved

Dynamic generate plain text email with new line

Posted on 2009-04-05
3
685 Views
Last Modified: 2012-05-06
Hi, i would like to generate plain text email dynamically from a string. Because the website email seen not to render the html code.

i try this but seen not success, expert please advice me.TQ

the result go to:

Reservation request to RJ Hotel Kulai - 05/04/2009 18:33:13vbcr --------------------------------------vbcrArrive: 15-04-2009vbcrDepart: 17-04-2009vbcrGuest: 1vbcrName: testvbcrGender: MalevbcrIc/PassporttestvbcrPhone: testvbcrFax: testvbcrEmail: leppon888@hotmail.comvbcrCountry: testvbcrCity: testvbcrAddress: testvbcr --------------------------------------vbcr

( there is no line break... ) wha's wrong.
Dim strCustomer As String = "Reservation request to " & ddlDepartments.SelectedItem.Text & " - " & DateTime.Now & "vbcr" & " --------------------------------------" & "vbcr" & _
            "Arrive: " & txtArrive.Text & "vbcr" & _
            "Depart: " & txtDepart.Text & "vbcr" & _
            "Guest: " & ddlGuest.SelectedValue & "vbcr" & _
            "Name: " & txtName.Text & "vbcr" & _
            "Gender: " & ddlGender.SelectedValue & "vbcr" & _
            "Ic/Passport" & txtIc.Text & "vbcr" & _
            "Phone: " & txtPhone.Text & "vbcr" & _
            "Fax: " & txtFax.Text & "vbcr" & _
            "Email: " & txtEmail.Text & "vbcr" & _
            "Country: " & txtCountry.Text & "vbcr" & _
            "City: " & txtCity.Text & "vbcr" & _
            "Address: " & txtAddress.Text & "vbcr" & " --------------------------------------" & "vbcr"

Open in new window

0
Comment
Question by:john8098
3 Comments
 
LVL 51

Accepted Solution

by:
Ryan Chong earned 125 total points
ID: 24074097
try " & vbCr & " instead of " & "vbcr" & _ ":

Dim strCustomer As String = "Reservation request to " & ddlDepartments.SelectedItem.Text & " - " & DateTime.Now & vbCr & _
            "--------------------------------------" & vbCr & _
            "Arrive: " & txtArrive.Text & vbCr & _
            "Depart: " & txtDepart.Text & vbCr & _
            "Guest: " & ddlGuest.SelectedValue & vbCr & _
            "Name: " & txtName.Text & vbCr & _
            "Gender: " & ddlGender.SelectedValue & vbCr & _
            "Ic/Passport" & txtIc.Text & vbCr & _
            "Phone: " & txtPhone.Text & vbCr & _
            "Fax: " & txtFax.Text & vbCr & _
            "Email: " & txtEmail.Text & vbCr & __
            "Country: " & txtCountry.Text & vbCr & _
            "City: " & txtCity.Text & vbCr & _
            "Address: " & txtAddress.Text & vbCr & " --------------------------------------" & vbCr
0
 
LVL 2

Expert Comment

by:asmyatt
ID: 24077258
Try Constants.vbCr or use Enviroment.NewLine. I code in C# for asp.net and use Enviroment.NewLine.
0
 

Author Closing Comment

by:john8098
ID: 31566852
Good
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question