JMail. Lave automatisk linieskift ved return?
Jeg har et spørgsmål der lyder på hvordan man får JMail til at lave linieskift når brugeren skriver nået i tekstboksen. Ellers står det hele på en og samme linie.Indsætter man manuelt et <br> i f.eks. tekstboksen kommer der også et linieskift. Men det skal jo bare ske når brugeren bruger return/linieskift.
Tak på forhånd...
<%
strForm = strForm & "<b>Kontaktform - domain</b><br><br>"
strForm = strForm & "<table border='1'>"
strForm = strForm & "<tr><td>Emne:</td><td width='100%'><b>" & Request.Form("emne") & "</b></td></tr>" & vbCRLF & vbCRLF
strForm = strForm & "<tr><td>Navn:</td><td width='100%'>" & Request.Form("navn") & "</td></tr>" & vbCRLF
strForm = strForm & "<tr><td>Virksomhed:</td><td width='100%'>" & Request.Form("virksomhed") & "</td></tr>" & vbCRLF
strForm = strForm & "<tr><td>Tlf.nr.:</td><td width='100%'>" & Request.Form("tlf") & "</td></tr>" & vbCRLF
strForm = strForm & "<tr><td>Email:</td><td width='100%'>" & Request.Form("email") & "</td></tr>" & vbCRLF & vbCRLF
strForm = strForm & "<tr><td>Kommentar:</td><td width='100%'>" & Request.Form("kommentar") & "</td></tr>" & vbCRLF
strForm = strForm & "</table><br>"
strForm = strForm & "Sendt fra www.domain.dk (auto)<br><br>"
' Create the JMail message Object
set msg = Server.CreateOBject( "JMail.Message" )
' Set logging to true to ease any potential debugging
' And set silent to true as we wish to handle our errors ourself
msg.Logging = true
msg.silent = true
' Most mailservers require a valid email address
' for the sender
msg.From = "kontakt@domain.dk"
msg.FromName = "domain"
' Next we have to add some recipients.
' The addRecipients method can be used multiple times.
' Also note how we skip the name the second time, it
' is as you see optional to provide a name.
msg.AddRecipient "email@hotmail.com"
' The subject of the message
msg.Subject = "Kontaktform"
' The body property is both read and write.
' If you want to append text to the body you can
' use JMail.Body = JMail.Body & "Hello world! "
' or you can use JMail.AppendText "Hello World! "
' which in many cases is easier to use.
'
' Note the use of vbCrLf to add linebreaks to our email
msg.HTMLBody = strForm
' There.. we have now succesfully created our message.
' Now we can either send the message or save it
' as a draft in a Database.
' To save the message you would typicly use the
' Message objects Text property
' to do something like this:
'
' SaveMessageDraft( msg.Text )
' Note that this function call is only an
' example. The function does not exist by
' default, you have to create it yourself.
' To send the message, you use the Send()
' method, which takes one parameter that
' should be your mailservers address
'
' To capture any errors which might occur,
' we wrap the call in an IF statement
if not msg.Send("mail3.cliche.dk" ) then
Response.write "<pre>" & msg.log & "</pre>"
else
Response.Redirect("kontakt_formsent.asp")
end if
' And we're done! the message has been sent.
%>
