---
title: "Function"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/7385-function"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Ricki"
published: "2000-12-10T19:13:00.000Z"
updated: "2000-12-10T19:34:00.000Z"
replies: 3
views: 226
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/7385-function"
---

# Function

## #1 — Ricki, 2000-12-10T19:13Z

Varför fungerar inte detta?

```
<%
Function SendMail(Title,Mess)

Line4:	Option Explicit
	Dim objNewMail

	'---- BodyFormat Property ----
	Const CdoBodyFormatHTML	= 1	' The Body property is to include Hypertext Markup Language (HTML).
	Const CdoBodyFormatText	= 0	' The Body property is to be exclusively in plain text (default value).
	
	'---- MailFormat Property ----
	Const CdoMailFormatMime	= 0	' The NewMail object is to be in MIME format.
	Const CdoMailFormatText	= 1	' The NewMail object is to be in uninterrupted plain text (default value).

	'---- Importance Property ----
	Const CdoLow	= 0		' Low importance
	Const CdoNormal	= 1	' Normal importance (default)
	Const CdoHigh	= 2		' High importance

	'---- AttachFile and AttachURL Methods ----
	Const CdoEncodingUUencode	= 0	' The attachment is to be in UUEncode format (default).
	Const CdoEncodingBase64	= 1	' The attachment is to be in base 64 format.

	Set objNewMail = Server.CreateObject("CDONTS.NewMail")
		objNewMail.From = "webmaster@ricki.nu"
		objNewMail.To = "webmaster@ricki.nu"
		objNewMail.Subject = Title
		objNewMail.Body = Mess
		objNewMail.BodyFormat = CdoBodyFormatText
		objNewMail.MailFormat = CdoMailFormatText
		objNewMail.Importance = CdoNormal
		objNewMail.Send
	Set objNewMail = Nothing

End Function
%>

<%
		'----------------------------------------------------------------
		' Skicka ett mail
		'----------------------------------------------------------------
		Title	= "design &#0124; Registrering"
		Mess	= "Välkommen som medlem i design!"

		SendMail (Title,Mess)
%>
```

Jag får följande felmeddelande:

Programsats förväntas.
/design/inc-filer/sendMail.inc, line 4
Option Explicit

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

## #2 — Vide, 2000-12-10T19:21Z

Option explicit måste ligga före allt annat...

Mvh, Vide

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

## #3 — Ricki, 2000-12-10T19:22Z

Före funktionen?
Vad gör Option explicit?

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

## #4 — Freestyler, 2000-12-10T19:34Z

Det ser väl till så att man måste deklarera variabler, eller?

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/7385-function
