Hur moddar jag denna kod så att det fungerar i ASP?? Och vad gör koden flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 till ta bort alla typdeklarationer: Den koden fungerar heller inte! Lite skum radbrytniung: Denna kod vill heller inte fungera:HJÄLP! CDO som inte vill fungera..
flds("http://schemas.microsoft.com/cdo/configuration/sendpassword")
= "psw"??
Private Sub SendMail(ByVal FromAdr As String, ByVal ToAdr As String,
ByVal Subject As String, ByVal Body As String)
Dim clsMessage As Object, flds As Object, clsConf As Object
Set clsConf = CreateObject("CDO.Configuration")
Set flds = clsConf.Fields
flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
flds("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "Mailserver.doamin.top"
flds("http://schemas.microsoft.com/cdo/configuration/sendusername")
= "user"
flds("http://schemas.microsoft.com/cdo/configuration/sendpassword")
= "psw"
flds.Update
Set clsMessage = CreateObject("CDO.Message")
Set clsMessage.Configuration = clsConf
clsMessage.From = "FromAdr"
clsMessage.To = "ToAdr"
clsMessage.Subject = "Subject"
clsMessage.TextBody = "Body"
clsMessage.Send
End SubSv: Moddning av VB-kod till ASP-kod
Private Sub SendMail(FromAdr, ToAdr, Subject,Body)
Dim clsMessage, flds, clsConf
Set clsConf = CreateObject("CDO.Configuration")
Set flds = clsConf.Fields
flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
flds("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "Mailserver.doamin.top"
flds("http://schemas.microsoft.com/cdo/configuration/sendusername")
= "user"
flds("http://schemas.microsoft.com/cdo/configuration/sendpassword")
= "psw"
flds.Update
Set clsMessage = CreateObject("CDO.Message")
Set clsMessage.Configuration = clsConf
clsMessage.From = "FromAdr"
clsMessage.To = "ToAdr"
clsMessage.Subject = "Subject"
clsMessage.TextBody = "Body"
clsMessage.Send
End SubSv: Moddning av VB-kod till ASP-kod
Detta är den befintliga koden:
<% Private Sub SendMail(FromAdr, ToAdr, Subject,Body)
Dim clsMessage, flds, clsConf
Set clsConf = CreateObject("CDO.Configuration")
Set flds = clsConf.Fields
flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
flds("http://schemas.microsoft.com/cdo/configuration/smtpserver")
= "Mailserver.doamin.top"
flds("http://schemas.microsoft.com/cdo/configuration/sendusername")
= "user"
flds("http://schemas.microsoft.com/cdo/configuration/sendpassword")
= "psw"
flds.Update
Set clsMessage = CreateObject("CDO.Message")
Set clsMessage.Configuration = clsConf
clsMessage.From = "martin@valhall.cx"
clsMessage.To = "martin@valhall.cx"
clsMessage.Subject = "Fungerar!"
clsMessage.TextBody = "Det fungerar!!"
clsMessage.Send
End Sub %>Sv: Moddning av VB-kod till ASP-kod
<code>
<%
Private Sub SendMail(FromAdr, ToAdr, Subject,Body)
Dim clsMessage
Dim flds
Dim clsConf
Set clsConf = Server.CreateObject("CDO.Configuration")
Set flds = clsConf.Fields
flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
flds("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "Mailserver.doamin.top"
flds("http://schemas.microsoft.com/cdo/configuration/sendusername") = "user"
flds("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "psw"
flds.Update
Set flds = Nothing
Set clsMessage = Server.CreateObject("CDO.Message")
Set clsMessage.Configuration = clsConf
clsMessage.From = "martin@valhall.cx"
clsMessage.To = "martin@valhall.cx"
clsMessage.Subject = "Fungerar!"
clsMessage.TextBody = "Det fungerar!!"
clsMessage.Send
Set clsMessage = Nothing
Set clsConf = Nothing
End Sub
%>
</code>Sv: Moddning av VB-kod till ASP-kod
<% Private Sub SendMail(FromAdr, ToAdr, Subject, Body)
Dim clsMessage, flds, clsConf
Set clsConf = Server.CreateObject("CDO.Configuration")
Set flds = clsConf.Fields
flds("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
flds("http://schemas.microsoft.com/cdo/configuration/smtpserver")= "mail.valhall.cx:3000"
flds("http://schemas.microsoft.com/cdo/configuration/sendusername")= "martin"
flds("http://schemas.microsoft.com/cdo/configuration/sendpassword")= "mittlosen"
flds.Update
Set clsMessage = Server.CreateObject("CDO.Message")
Set clsMessage.Configuration = clsConf
clsMessage.From = "ms@gvb.nu"
clsMessage.To = "martin@valhall.cx"
clsMessage.Subject = "Fungerar!"
clsMessage.TextBody = "Det fungerar!!"
clsMessage.Send
End Sub %>
Adressen till mejlen är mail.valhall.cx:3000...