|
-
Jun 29th, 2005, 02:18 PM
#1
Thread Starter
Junior Member
Question about Email body in my asp.net
Hi experts,
My asp.net application will send an email to our marketing department when a user filled out the application.
In my strBody of the following code, it will list all 6 strCheckBoxs (string value) from my application. If
However, how to write the lines that only when strCheckBoxs is not an empty string? I mean, skip the line if the strCheckBox is an empty string ""???
Can I use IF--ELSE statement somewhere in this code to eliminate the rows which contains empty string strCheckBox????
Thank you.
--------------------------------------------------------------------------
Dim msgFax As MailMessage = New MailMessage
msgFax.To = "name@domain"
msgFax.From = "webmaster@domain"
msgFax.Subject = "PRIMARY SCHOOL APPLICATION"
msgFax.BodyFormat = MailFormat.Html
Dim strBody As String
strBody = "<h3>BK and PRIMARY SCHOOL </h3>" + "<br>" + _
" __________________________________________________ ________" + "<br>" + _
"
"- CERTIFICATE OF ACHIEVEMENT - " + "<br>" + _
" * " & strCheckBox1 + "<br>" + _
" * " & strCheckBox2 + "<br>" + _
" * " & strCheckBox3 + "<br>" + _
" * " & strCheckBox4 + "<br>" + _
" * " & strCheckBox5 + "<br>" + _
" * " & strCheckBox6 + "<br>" + _
" * Comments : " & txtComment.Text + "<br>"
msgFax.Body = strBody
SmtpMail.SmtpServer = "server.companyname.com"
SmtpMail.Send(msgFax)
-
Jun 29th, 2005, 06:02 PM
#2
Re: Question about Email body in my asp.net
VB Code:
Private Function CreateBody() As String
Dim strBody As String = "<h3>BK and PRIMARY SCHOOL </h3>" & "<br>" & _
" __________________________________________________ ________" & "<br>" & _
"- CERTIFICATE OF ACHIEVEMENT - " + "<br>"
If CheckBox1.Checked = True Then strBody &= " * " & strCheckBox1 + "<br>"
If CheckBox2.Checked = True Then strBody &= " * " & strCheckBox2 + "<br>"
If CheckBox3.Checked = True Then strBody &= " * " & strCheckBox3 + "<br>"
If CheckBox4.Checked = True Then strBody &= " * " & strCheckBox4 + "<br>"
If CheckBox5.Checked = True Then strBody &= " * " & strCheckBox5 + "<br>"
If CheckBox6.Checked = True Then strBody &= " * " & strCheckBox6 + "<br>"
strBody &= " * Comments : " & txtComment.Text & "<br>"
Return strBody
End Function
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|