string

  • Thread starter Thread starter amatuer
  • Start date Start date
A

amatuer

Hi,

I have a variable that i am passing to a function that creates and
sends an email. i would like to break the string into 2lines. Can
anyone help with this?

here's the string:

strMessage = "Your personal details have been received & your Logon
details are: Username: " & txtId.Text & ", Password: " &
txtSurname.Text

Thanks
 
Are you talking about continuing same string on next line ?
If yes, then include new line character - \n or Environment.NewLine
at the place from where you want to break the string.
 
Are you talking about continuing same string on next line ?
If yes, then include new line character - \n or Environment.NewLine
at the place from where you want to break the string.

hi coolcoder,
I've tried \n and vbnewline and vbCrLf but it doesnt work.

On my previous post about the hyperlink: i used the navigate url
property bt it didnt work due to an incorrect url.
 
I have a variable that i am passing to a function that creates and
sends an email. i would like to break the string into 2lines. Can
anyone help with this?
This sound strand, may I ask "Why are you not simple passing two strings?

Cor
 
This sound strand, may I ask "Why are you not simple passing two strings?

Cor

Dim strFrom As String = "(e-mail address removed)"
Dim strTo As String = txtEMail.Text
Dim strSubject As String = "Online Assessor/Moderator
Registration"
Dim strMessage As String
Dim strMessage1 As String
strMessage = "Your personal details have been received
& your Logon details are:"
strMessage1 = "Username: " & txtId.Text & ", Password:
" & txtSurname.Text
Dim obj21 As Businesslayer.Sendmail = New
Businesslayer.Sendmail
obj21.Sendmail(strFrom, strTo, strSubject, strMessage,
strMessage1)

Public Sub Sendmail(ByVal strFrom As String, ByVal strTo As String,
ByVal strSubject As String, ByVal strMessage As String, ByVal
strMessage1 As String)
'This procedure overrides the first procedure and accepts a
single
'string for the recipient and file attachement
GetSMTPIP()
Try
Dim MailMsg As New MailMessage(New
MailAddress(strFrom.Trim()), New MailAddress(strTo))

MailMsg.Subject = strSubject.Trim()
MailMsg.Body = strMessage.Trim() & vbCrLf &
strMessage1.Trim()
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True

'Smtpclient to send the mail message
Dim SmtpMail As New SmtpClient
SmtpMail.Host = SMTPIP
SmtpMail.Send(MailMsg)
Catch ex As Exception
'Message Error
End Try
End Sub

This above code still puts everything on 1 line
 
amatuer said:
Dim MailMsg As New MailMessage(New
MailAddress(strFrom.Trim()), New MailAddress(strTo))
MailMsg.Subject = strSubject.Trim()
MailMsg.Body = strMessage.Trim() & vbCrLf &
strMessage1.Trim()
MailMsg.Priority = MailPriority.High
MailMsg.IsBodyHtml = True .. . .
This above code still puts everything on 1 line

I don't think it does.

If you examine the assembled message body just /before/ it's sent,
you'll see the line break in it.

If you look at the message once it's been sent using anything that's
Html aware - like your mail client program - you /won't/ see it. It
/is/ still there, but vbCrLf doesn't mean a thing in Html.

If you want to have a line-break in some Html then you have to use an
Html line-break, like this:

MailMsg.Body = strMessage.Trim() _
& "<br />" _
& strMessage1.Trim()

HTH,
Phill W.
 
I don't think it does.

If you examine the assembled message body just /before/ it's sent,
you'll see the line break in it.

If you look at the message once it's been sent using anything that's
Html aware - like your mail client program - you /won't/ see it. It
/is/ still there, but vbCrLf doesn't mean a thing in Html.

If you want to have a line-break in some Html then you have to use an
Html line-break, like this:

MailMsg.Body = strMessage.Trim() _
& "<br />" _
& strMessage1.Trim()

HTH,
Phill W.

Thanks alot Phil
 
Back
Top