tags:

views:

22

answers:

1

I want to below script to send an email to lotus notes, but I find that in lotus notes, the font size of body message is a little bigger, so I want to change its font size to a small one, but due to string body in below function is a variable, I don't know how to change its font size, so could anyone here can help me ? thanks in advance

    Public Shared Sub SendMail(ByVal from As String, ByVal towhere As String, ByVal subject As String, ByVal body As String)
    Dim mailservername As String
    mailservername = "[email protected]"

    Dim Message As New System.Net.Mail.MailMessage(from, towhere, subject, body)

    Dim mailClient As New System.Net.Mail.SmtpClient()
    mailClient.Host = mailservername
    mailClient.UseDefaultCredentials = True
    mailClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis
    mailClient.Send(Message)
    End Sub

   the body message is such as body = str1 + " " + str2 + " " + str3
   str1 and str2 are constant strings, but str3 are variable, what I want to change is str3's font size
+1  A: 

The mail body can be in different formats. What your using above is pain text format (content type is text/plain). You can use html format (text/html) along with (or instead of) text format, then in html, you can style your mail richly using CSS styles or html tags. See this article that introduce how to send an html mail.

Edit: Edited to put code fragment (in comment, it becomes messy)

body = "<span style=""font-size:10pt;"">" + str1 + " " + str2 + "</span><span style=""font-size:12pt;"">" + str3 + "</span>"
mailClient.Body = body
mailClient.IsBodyHtml = True
VinayC
the body message is such as body = str1 + " " + str2 + " " + str3str1 and str2 are constant strings, but str3 are variable, what I want to change is str3's font size
If your using html body then you can put str3 in span tag and specify font size there. For example,body = "<span style=""font-size:10pt;"">" + str1 + " " + str2 + "</span><span style=""font-size:12pt;"">" + str3 + "</span>"
VinayC
thanks, it works