incabus.se / Kundtjänst / Web Hosting / Skicka epost med ASP
Dokumentåtgärder
Bookmark and Share

Skicka epost med ASP

Vill du skicka epost från din hemsida?
Du kan använda scriptet nedan för att skicka epost från din hemsida. Kopiera joden och klistra in den i en ASP fil. Du behöver modifiera koden något så att den passar dina behov.

<%
' Send by connecting to port 25 of the SMTP server.
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML

Const cdoSendUsingPort = 2

set iMsg = CreateObject("CDO.Message")
set iConf = CreateObject("CDO.Configuration")
Set Flds = iConf.Fields
' Set the CDOSYS configuration fields to use port 25 on the SMTP server.
With Flds
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Update
End With

' Build HTML for message body.
strHTML = "<HTML>"
strHTML = strHTML & "<HEAD>"
strHTML = strHTML & "<BODY>"
strHTML = strHTML & "<b> This is the test HTML message body</b></br>"
strHTML = strHTML & "</BODY>"
strHTML = strHTML & "</HTML>"

 Apply the settings to the message.
With iMsg
Set .Configuration = iConf
.To = "name@domain.com"
.From = "name@domain.com"
.Subject = "Ämne"
.HTMLBody = strHTML
.Send
End With

' Clean up variables.
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
%>

Vill du gå vidare?
Du kan läsa mer om hur du använder CDO på Microsofts hemsida. Klicka på denna länk och sök mer information i ämnet.

Senast ändrad 2006-07-28 16:51