.NETGURU
Dynamic Mail Body
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-mail' list.


Bryan Andrews
I have a mailer setup that will query a table and grab the contents
(body) of an email and dynamically create the email and send.

I am having problems creating the line breaks though from the carriage
returns in the dbase.

My Code looks something like this:

smtpMssg.Body =3D GetDescription(dtrResults.Item("msgBody"))

My function is:

Function GetDescription(ByVal Description As String) As String
    If Description.Length > 1 Then
        Description =3D Replace(Description, vbCrLf, "Chr(13)")
        Return Description
    End If
End Function

The problem is that the Chr(13) just writes out in the body of my email
instead of converting to line breaks.

Could someone tell me what I might do to get the mailmessage object to
recognize the chr(13) as a line break?

Thanks!

Reply to this message...
 
    
G. Andrew Duthie
I would suggest removing the quotes from around the Chr(13):

    Description =3D Replace(Description, vbCrLf, Chr(13))

That should do the trick.

Hth,

--
G. Andrew Duthie
Graymad Enterprises, Inc.
http://www.graymad.com
Click here to reveal e-mail address
Author, Microsoft ASP.NET Step By Step
http://www.amazon.com/exec/obidos/ASIN/0735612870/

[Original message clipped]

Reply to this message...
 
    
Bryan Andrews
That did indeed work. Thanks.

-----Original Message-----
From: G. Andrew Duthie [mailto:Click here to reveal e-mail address]
Sent: Monday, March 25, 2002 1:02 AM
To: ngfx-mail
Subject: [ngfx-mail] RE: Dynamic Mail Body

I would suggest removing the quotes from around the Chr(13):

Description =3D Replace(Description, vbCrLf, Chr(13))

That should do the trick.

Hth,

--
G. Andrew Duthie
Graymad Enterprises, Inc.
http://www.graymad.com
Click here to reveal e-mail address
Author, Microsoft ASP.NET Step By Step
http://www.amazon.com/exec/obidos/ASIN/0735612870/

[Original message clipped]

| [ngfx-mail] member Click here to reveal e-mail address =3D YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-mail.asp =3D JOIN/QUIT

Reply to this message...
 
    
Guha, Rahul
I changed the contenttype to HTML and replaced vbcrlf by <br> ... that
worked ...

-----Original Message-----
From: Bryan Andrews [mailto:Click here to reveal e-mail address]
Sent: Sunday, March 24, 2002 4:58 PM
To: ngfx-mail
Subject: [ngfx-mail] Dynamic Mail Body

I have a mailer setup that will query a table and grab the contents
(body) of an email and dynamically create the email and send.

I am having problems creating the line breaks though from the carriage
returns in the dbase.

My Code looks something like this:

smtpMssg.Body = GetDescription(dtrResults.Item("msgBody"))

My function is:

Function GetDescription(ByVal Description As String) As String
If Description.Length > 1 Then
Description = Replace(Description, vbCrLf, "Chr(13)")
Return Description
End If
End Function

The problem is that the Chr(13) just writes out in the body of my email
instead of converting to line breaks.

Could someone tell me what I might do to get the mailmessage object to
recognize the chr(13) as a line break?

Thanks!

| [ngfx-mail] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-mail.asp = JOIN/QUIT

Reply to this message...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification