---
title: "CDO"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/164632-cdo"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "devotion"
published: "2007-09-18T18:24:10.000Z"
updated: "2007-09-19T07:00:41.000Z"
replies: 5
views: 350
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/164632-cdo"
---

# CDO

## #1 — devotion, 2007-09-18T18:24Z

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

Bilagor:

- [ScreenShot001.jpg](https://www.webforum.nu/a/15942.jpg)

Permalänk: https://www.webforum.nu/p/164632

## #2 — devotion, 2007-09-19T06:20Z

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

Permalänk: https://www.webforum.nu/p/2029647

## #3 — Zaiman, 2007-09-19T06:46Z

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
```

Permalänk: https://www.webforum.nu/p/2029653

## #4 — devotion, 2007-09-19T06:51Z

Okej!  :)  

Men,en idiotfråga kanske.... Användarnamn och Lösenord???

Mvh
Henrik

Permalänk: https://www.webforum.nu/p/2029654

## #5 — colione, 2007-09-19T06:56Z

Om det behövs för att autenticiera dig mot smtp-servern.

Permalänk: https://www.webforum.nu/p/2029655

## #6 — devotion, 2007-09-19T07:00Z

Okej! :)

Permalänk: https://www.webforum.nu/p/2029657

---

Tråden på webben: https://www.webforum.nu/amne/asp/164632-cdo
