aplimedia
asked on
change font mailSettings in asp.net 4
I want to send emails from my web. For this I use mailSettings in web.config
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="me@me.com">
<network
host="mail.me.com"
port="25"
userName="me@me.com"
password="abcd" />
</smtp>
</mailSettings>
</system.net>
In the button I use next code:
Dim mymessage As MailMessage = New MailMessage()
mymessage.Subject = "Hello"
mymessage.Body = "Hola from me.com "
mymessage.From = New MailAddress("me@me.com", "me.com")
mymessage.To.Add(New MailAddress(TextBox1.Text) )
Dim mysmtpclient As SmtpClient = New SmtpClient()
mysmtpclient.Send(mymessag e)
everything works fine except I would like to change the font and font size of the text in my body email.
Is there any way to do this? Thanks
<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="me@me.com">
<network
host="mail.me.com"
port="25"
userName="me@me.com"
password="abcd" />
</smtp>
</mailSettings>
</system.net>
In the button I use next code:
Dim mymessage As MailMessage = New MailMessage()
mymessage.Subject = "Hello"
mymessage.Body = "Hola from me.com "
mymessage.From = New MailAddress("me@me.com", "me.com")
mymessage.To.Add(New MailAddress(TextBox1.Text)
Dim mysmtpclient As SmtpClient = New SmtpClient()
mysmtpclient.Send(mymessag
everything works fine except I would like to change the font and font size of the text in my body email.
Is there any way to do this? Thanks
ASKER
If I change my code:
mymessage.Body = "Hello"
by
mymessage.Body = "<span style=""color:red;font-wei ght:bold;" ">pretty colors!!</span>" & "Hello"
the mails I send looks like:
<span style="color:red;font-weig ht:bold;"> pretty colors!!</span>Hello
is there anything else I have to add or change, thanks.
mymessage.Body = "Hello"
by
mymessage.Body = "<span style=""color:red;font-wei
the mails I send looks like:
<span style="color:red;font-weig
is there anything else I have to add or change, thanks.
It might help to use
mymessage.BodyFormat = MailFormat.Html
mymessage.BodyFormat = MailFormat.Html
ASKER
I have
Imports System.Net.Mail
not
Imports System.Web.Mail
Imports System.Net.Mail
not
Imports System.Web.Mail
ASKER
ok, I found the solution is to use:
mymessage.IsBodyHtml = True
but somebody can send me an example of the code I need to use in html (I don´t know html)
just to send the text in courier new font
My problem is very easy I think, I need to send mails (I have it and it works) but the font must be courier new instead the default font.
mymessage.IsBodyHtml = True
but somebody can send me an example of the code I need to use in html (I don´t know html)
just to send the text in courier new font
My problem is very easy I think, I need to send mails (I have it and it works) but the font must be courier new instead the default font.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you send the Mail like this it's a automaticaly send as a Textmail and then it's not possible
Or you make it a HTML-Mail using simple tags
mymessage.Body = "<span style=""color:red;font-wei
This way you can use styles or inner CSS in your mail
regards
poor beggar