vb.net - Email line breaks not working -
i trying force line breaks inside body of automatic email.
i have referenced many examples, such "adding multiple lines body of smtp email vb.net".
i've tried many different ways make line breaks:
stringbuilder.appendline
dim sb new stringbuilder sb.appendline("for security purposes, password provided within email.") sb.appendline("thank , have wonderful day.")
system.environment.newline
strbody = strbody & "thank , have wonderful day. " & system.environment.newline strbody = strbody & "password: " & dsa.tables(0).rows(0).item(2) & system.environment.newline & system.environment.newline
vbnewline
strbody = strbody & "thank , have wonderful day. " & vbnewline
vbcrlf
strbody = strbody & "thank , have wonderful day. " & vbcrlf
environment.newline
strbody = strbody & "thank , have wonderful day. " & environment.newline
and on, every time receive email there no line breaks.
is there other versions can test?
dim strbody string try dim strto string strbody = "" strbody = strbody & "thank contacting gain account access. " & vbnewline strbody = strbody & "you requested password applicaton registration site. " & vbnewline strbody = strbody & "for security purposes, password provided within email. " & vbnewline strbody = strbody & "thank , have wonderful day. " & vbnewline strbody = strbody & "password: " & dsa.tables(0).rows(0).item(2) & system.environment.newline & vbnewline & vbnewline strbody = strbody & "if didn't request password, please notify from@location.com of concern " strto = dsa.tables(0).rows(0).item(1) dim msg new system.net.mail.mailmessage("from@we-location.com", strto, "retrive password", strbody) dim smtp new system.net.mail.smtpclient msg.isbodyhtml = true smtp.host = "mailhost.location.com" smtp.send(msg) catch ex exception end try
the key line of code here this:
msg.isbodyhtml = true
since sending html email must use html markup create line breaks.
strbody = strbody & "thank contacting gain account access. <br><br>"
Comments
Post a Comment