Jag har sökt runt lite, och det verkar vara någon inställning eller något på webservern... Ingen som vet något mer?
Mvh
Henrik
5 svar · 350 visningar · startad av devotion
Hej!
Har gjort en mailfunktion i som fungerar finfint lokalt (Win-XP)
Men, när jag la upp det på servern (win2003), så får jag felmeddelande enligt bifogad fil:
CDO.Message.1 error '80040220'
The "SendUsing" configuration value is invalid.
/WebUppdrag/savenewtask.asp, line 258
Koden ser ut så här:
sTo = "xxx@xxx.se"
sCc = ""
sFrom = "xxx@xxx.se"
sSubject = "Beställning gjord av " & Session("sLoginCustomerName") & " via webbmodulen; " & Now()
'Meddelande
sTextBody = "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>" &_
"<html xmlns='http://www.w3.org/1999/xhtml'>" &_
"<head>" &_
"<meta http-equiv='Content-Type'< content='text/html; charset=iso-8859-1' />" &_
"<title>Untitled Document</title>" &_
"<style type='text/css'>" &_
"body {" &_
"font-family: Arial, Helvetica, sans-serif;" &_
"font-size: 12px;" &_
"}" &_
"</style>"&_
"</head>" &_
"<html>" &_
"<h3>Följande beställning är gjord, " & Now() & "</h3>" &_
"<b>Kund</b><br>" &_
"Kund: " & Session("sLoginCustomerName") & "<br>" &_
"Kundnummer: " & Session("sLoginCustomerNr") & "<br>" &_
"Beställare: " & p_CustomerOrderer & "<br> " &_
"Referens: " & p_CustomerRef & "<br><br> "&_
"<b>Objekt</b><br>" &_
"Anläggning: " & sObject1Name & "<br>" &_
"Aggregat: " & sObject2Name & "<br><br>" &_
"<b>Uppdrag</b><br>" &_
"Inköps/PO-nr: " & p_CustomT3 & "<br>" &_
"Uppdrag: " & p_Task &_
"</html>"
Set objMail = Server.CreateObject("CDO.Message")
objMail.From = sFrom
objMail.To = sTo
objMail.Bcc = sCc
objMail.Subject= sSubject
objMail.HTMLBody = sTextBody
[b]--->objMail.Send [/b]
Set objMail = Nothing
Vad är fel? :)
Mvh
Henrik
Jag har sökt runt lite, och det verkar vara någon inställning eller något på webservern... Ingen som vet något mer?
Mvh
Henrik
Så här har jag fått det att fungera. Tror du behöver specificera smtpservern du ska skicka med. Titta på denna kod:
' send by connecting to port 25 of the SMTP server
Dim iMsg
Dim iConf
Dim Flds
Dim strHTML
Dim strSmartHost
Dim obj
Const cdoSendUsingPort = 2
StrSmartHost = "min.smtpserver.nu"
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") = strSmartHost
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = Basic
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "användarnamn"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "lösenord"
.Update
End With
' build for message body
sBody = Request.Form("meddelande")
' apply the settings to the message
With iMsg
Set .Configuration = iConf
.To = "skickastill"
.From = Request.Form("epost")
.Subject = "Meddelande från "
.TextBody = sBody
.Send
End With
' cleanup of variables
Set iMsg = Nothing
Set iConf = Nothing
Set Flds = Nothing
Om det behövs för att autenticiera dig mot smtp-servern.
Okej! :)