---
title: "Automatiskt mail vid insert i databas"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/47068-automatiskt-mail-vid-insert-i-databas"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Gimbo"
published: "2002-07-02T14:39:51.000Z"
updated: "2002-07-02T15:40:46.000Z"
replies: 2
views: 224
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/47068-automatiskt-mail-vid-insert-i-databas"
---

# Automatiskt mail vid insert i databas

## #1 — Gimbo, 2002-07-02T14:39Z

Hejsan!

Jag har ett problem har som jag inte kan fa att fungera, efter att ngn har gjort en insert i databasen sa vill jag att ett mail ska skickas till mig och en kollega till mig, men jag kan inte fa det att fungera, sa har ser d ut:

```
<%
.
.
.
massa kod med insert into osv.

 Conn.Execute(SQL)
   
Response.Redirect "done.asp"

' send e-mail
'Set variables to format the subject and body fields
'Creates the Email object & sends the email
Set objNewMail  = Server.CreateObject("CDONTS.NewMail")
objNewMail.from  = "kolleganasmail"
objNewMail.To  = "min mail"
objNewMail.Subject  = "rubriken har"
objNewMail.Body   = "innehallet pa mailet har" 
objNewMail.Send
Set objNewMail   = nothing
%>
```

ngn som tro sig veta vart problemet ligger?

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

## #2 — LAMP, 2002-07-02T14:52Z

All kod som ligger efter response.redirect körs aldrig, flytta din redirect till sist i koden.

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

## #3 — @nders, 2002-07-02T15:40Z

Avsändaradressen måste också vara giltig.

Mvh,

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

---

Tråden på webben: https://www.webforum.nu/amne/asp/47068-automatiskt-mail-vid-insert-i-databas
