(asp) email formulier

Pagina: 1
Acties:

  • m1ch3lb
  • Registratie: Januari 2002
  • Laatst online: 09-07-2022
hallo,

ik heb een email formulier wat ik ga gebruiken nu heeft een vriend van mij het proberen te gebruiken en we weten allebei niet veel van asp, dus willen jullie zo vriendelijk zijn aan te geven wat er fout is in deze
code:
1
2
3
4
5
ik heb de code weggehaald 
omdat ik antwoord op een 
deel van mijn vraag heb en
zo wordt de layout niet 
langer meer verkracht.

:)

Verwijderd

hahaha, grapjas :)
kan je eerst de code eens tussen [ code ] tags plaatsen (eindtag = [ /code ] )

ten tweede: met HTML zijn we niet veel, dus dat kan je ook wel weglaten.

Ten derde: welke foutmelding krijg je, want dat is wel handig om te weten, plus op welke regel.

bedankt :)

edit: een plaatje [ img ] de url ervan [ /img ]
(zonder de spaties)

en ik merk dat je hier nieuw bent, dan is het handig als je de algemene FAQ en deze van Programming en Webscripting even doorneemt. Bespaart je veel gezeur achteraf. Welkom :)

  • m1ch3lb
  • Registratie: Januari 2002
  • Laatst online: 09-07-2022
ik wil het porbleem uitleggen met behulp van een plaatje dus hoe moet ik een plaatje posten???

ik zal ff mijn post editten

Afbeeldingslocatie: http://www.endoria.net/upload/?bekijk=1011723179

het probleem: als ik op verzenden druk dan geeft hij dus deze foutmelding ook al heb je alles ingevuld.

hopelijk is dit uitgebreid genoeg beschreven.


ps: ik zal de FAQ eens doorlezen want ik heb alleen nog maar de algemene doorgelezen

Verwijderd

voor plaatje -> zie mijn post hierboven

edit: haal nu eens het grootste deel van die HTML code eruit aub, bvb al die OPTIONs, daar zijn we niets mee.

Bovendien, welke error krijg je? of staat dat in dat plaatje?

en kan je bovendien ook de code van wat spaties voorzien? in de FAQ staat daar wat interessants over (van D2k geloof ik)

  • m1ch3lb
  • Registratie: Januari 2002
  • Laatst online: 09-07-2022
sorry dat ik de code niet kan editten want ik weet niet precies wat ik meot verwijderen omdat er heel veel bij is gekomen wat er oorspronkelijk niet staat.

  • Bally
  • Registratie: November 2001
  • Laatst online: 24-08 11:28

Bally

1200 + 1500 Wp

Ik zal binnenkort een stukje mailen wat wel werkt. heb ik wel eens gemaakt op mijn werk enzo.

Hoop is uitgestelde teleurstelling


  • Crazy D
  • Registratie: Augustus 2000
  • Laatst online: 15-09 19:11

Crazy D

I think we should take a look.

Op dinsdag 22 januari 2002 19:18 schreef m1ch3lb het volgende:
sorry dat ik de code niet kan editten want ik weet niet precies wat ik meot verwijderen omdat er heel veel bij is gekomen wat er oorspronkelijk niet staat.
Alle "<td>"'s waar <select>, <option>, en </select> in staat.
Dat scheelt minimaal de helft van die lap code ;)

Verder is "hij doet het niet" niet de meest duidelijke omschrijving van een probleem :P
code:
1
2
3
4
5
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "smtp.casema.net" ' Specify a valid SMTP server
Mail.From = Email ' Specify sender's address

Mail.AddAddress "jacanja@casema.net"

Staat het betreffende mail component op de server?
Mag je via casema.net gewoon mailen zonder in te loggen oid?
Als bovenstaande wel goed is, probeer het eens met een "From name" die ook casema.net adres is.

Exact expert nodig?


Verwijderd

ervan uitgaande dat je Persits MailSender werkt op de server is dit een werkend script:
code:
1
2
3
4
5
6
7
8
9
10
11
12
Set Mailer = Server.CreateObject("Persits.MailSender")
    Mailer.Host = "mail.***.com"

    Mailer.FromName   = "Thomas"
    Mailer.From= "asp@microsoft.com"

    Mailer.AddAddress "you@domain.nl","Jij"
    
    Mailer.Subject    = "Je bent een klootzak"
    Mailer.Body   = "blaat sorry ik meende het niet"

Mailer.Send

op het eerste gezicht is dit wat er bij jou staat, maar vul eens de gegevens in bij
code:
1
2
Mail.From = Email ' Specify sender's address
Mail.FromName = Name ' Specify sender's name

volgens mij is dit wel verplicht...

dus bvb
code:
1
2
Mail.From = "ik@mijndomain.nl" ' Specify sender's address
Mail.FromName = "Ikke!!" ' Specify sender's name

  • oZy
  • Registratie: Juli 2001
  • Laatst online: 15-09 14:10

oZy

Op dinsdag 22 januari 2002 19:10 schreef m1ch3lb het volgende:
het probleem: als ik op verzenden druk dan geeft hij dus deze foutmelding ook al heb je alles ingevuld.
Je hebt een asp script gedownload maar weet niet hoe het werkt. Je moet namelijk alle velden correct invullen voordat hij begint met het verzenden. Het is geen schande om een prefabricated script te downloaden en gebruiken, maar onthou voortaan dat het 9 van de 10x slechte scripts zijn, deze zit bijv. dom in elkaar. Hoe dan ook, ga eerst stap voor stap door de code heen zodat je de procedure begrijpt, dan pas beslissen of dit aansluit op jouw situatie.

HTH

edit:
note: alle velden correct invullen.

zet anders even de volgende regel na de validatie:
[code]response.write "bName = " & bName & "<br>" & "bEmail = " & bEmail & "<br>" & "bSubject = " & bSubject & "<br>" & "bMessage = " & bMessage & "<br>"[/code]
dit zet je dus voor deze regel:
[code]If bName and bEmail and bSubject and bMessage = True and vTry = "Second" or vTry = "Third" Then[/code]

  • m1ch3lb
  • Registratie: Januari 2002
  • Laatst online: 09-07-2022
In de code staat:
code:
1
2
3
4
5
6
vTry = Request.QueryString("Try")
bValidForm = False
vName = ""
Email = ""
vSubject = ""
vMessage = ""

moet dit niet zijn
code:
1
2
3
4
5
6
vTry = Request.QueryString("Try")
bValidForm = False
vName = ""
vEmail = ""
vSubject = ""
vMessage = ""

dus is de maker niet vergeten de v toe te voegen aan het woord email?

  • raptorix
  • Registratie: Februari 2000
  • Laatst online: 17-02-2022
function sendmail(emailto,emailfrom,subject,body)
Set objMail = Server.CreateObject("CDONTS.NewMail")
ObjMail.BodyFormat = 0
ObjMail.MailFormat = 0
objMail.From = emailfrom
objMail.To = emailto
objMail.Subject = subject
objMail.Body = body
objMail.Send
Set objMail = Nothing
end function

  • m1ch3lb
  • Registratie: Januari 2002
  • Laatst online: 09-07-2022
Nog een vraagje:
code:
1
2
Mail.Subject = Subject
Mail.Body = Message

Kan je bij die Mail.Body ook meerdere dingen laten toevoegen?
Bijv.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
Mail.Subject = Subject
Mail.Body = Pole 
        Second in qualifying 
        Third in qualifying 
        Fourth in qualifying 
        Fifth in qualifying 
        Sixth in qualifying 
        Racewinner 
        Second 
        Third 
        Fourth 
        Fifth 
        Sixth

  • ParaNoiMia
  • Registratie: Mei 2000
  • Laatst online: 13-09 20:19
Op woensdag 23 januari 2002 13:14 schreef m1ch3lb het volgende:
Nog een vraagje:
code:
1
2
Mail.Subject = Subject
Mail.Body = Message

Kan je bij die Mail.Body ook meerdere dingen laten toevoegen?
Bijv.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
Mail.Subject = Subject
Mail.Body = Pole 
        Second in qualifying 
        Third in qualifying 
        Fourth in qualifying 
        Fifth in qualifying 
        Sixth in qualifying 
        Racewinner 
        Second 
        Third 
        Fourth 
        Fifth 
        Sixth
dim strBody
strBody = "Pole" & vbCrLf
strBody = strBody & "Second in qualifying" & vbCrLf
Mail.Body=strBody

etc.

  • rambo-2001
  • Registratie: November 2000
  • Laatst online: 02-01-2024

rambo-2001

be anonymous

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<%
set mail = server.createobject("cdonts.newmail")
mail.to = request.form ("emailadres")
mail.from = request.form ("afzender")
mail.cc = request.form ("cc")
mail.importance = request.form ("gevoeligheid") 
mail.subject = request.form ("onderwerp")
mail.body = request.form ("bericht") & chr(10) & 
"---------------------------------------------------------" & chr(10) & 
(request.servervariables("remote_addr")) & " is gebruikt om deze e-mail te verzenden." & 
chr(10) & "Deze e-mail is verzonden via de webserver van ..."
mail.send
set mail = nothing
%>

nu als je iets extra's wil toevoegen gewoon de request.form optie gebruiken.
hele uitleg over dit alles staat in het boek : snel leren werken met ASP

edit:

er is ook een andere mogelijkheid en dat is het maken van een txt bestand volgens mij in de mail/query
waar alle mail wordt opgehaald.

cs skill - making a desert eagle out of tooth picks


  • m1ch3lb
  • Registratie: Januari 2002
  • Laatst online: 09-07-2022
als ik het goed bergijp moet het dus zo:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Mail.Subject = Subject
dim strBody
strBody = "Pole" & vbCrlf
strBody = strBody & "Second in qualifying" & vbCrLf
strBody = strBody & "Third in qualifying" & vbCrLf
strBody = strBody & "Fourth in qualifying" & vbCrLf
strBody = strBody & "Fifth in qualifying" & vbCrLf
strBody = strBody & "Sixth in qualifying" & vbCrLf
strBody = strBody & "Racewinner" & vbCrLf
strBody = strBody & "Second" & vbCrLf
strBody = strBody & "Third" & vbCrLf
strBody = strBody & "Fourth" & vbCrLf
strBody = strBody & "Fifth" & vbCrLf
strBody = strBody & "Sixth" & vbCrLf
Mail.Body = strBody

  • ParaNoiMia
  • Registratie: Mei 2000
  • Laatst online: 13-09 20:19
Op woensdag 23 januari 2002 13:25 schreef m1ch3lb het volgende:
als ik het goed bergijp moet het dus zo:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Mail.Subject = Subject
dim strBody
strBody = "Pole" & vbCrlf
strBody = strBody & "Second in qualifying" & vbCrLf
strBody = strBody & "Third in qualifying" & vbCrLf
strBody = strBody & "Fourth in qualifying" & vbCrLf
strBody = strBody & "Fifth in qualifying" & vbCrLf
strBody = strBody & "Sixth in qualifying" & vbCrLf
strBody = strBody & "Racewinner" & vbCrLf
strBody = strBody & "Second" & vbCrLf
strBody = strBody & "Third" & vbCrLf
strBody = strBody & "Fourth" & vbCrLf
strBody = strBody & "Fifth" & vbCrLf
strBody = strBody & "Sixth" & vbCrLf
Mail.Body = strBody
Yep. En als je netjes programmeert zet je die dim bovenaan je functie of je asp pagina.

  • m1ch3lb
  • Registratie: Januari 2002
  • Laatst online: 09-07-2022
ik zal nu opnieuw de code psoten die ik met jullie help heb ge-edit maar willen jullie nu nog ff kijken of er nog een fout in staat???
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
<%
'Dim variables
Dim vTry, bValidForm
Dim vName, vEmail, vPole, vSecond in qualifying, vThird in qualifying, vFourth in qualifying, vFifth in qualifying, vSixth in qualifying, vRacewinner, vSecond, vThird, vFourth, vFifth, vSixth
Dim bName, bEmail, bPole, bSecond in qualifying, bThird in qualifying, bFourth in qualifying, bFifth in qualifying, bSixth in qualifying, bRacewinner, bSecond, bThird, bFourth, bFifth, bSixth

vTry = Request.QueryString("Try")
bValidForm = False
vName = ""
vEmail = ""
vPole = ""
vSecond in qualifying = ""
vThird in qualifying = ""
vFourth in qualifying = ""
vFifth in qualifying = ""
vSixth in qualifying = ""
vRacewinner = ""
vSecond = ""
vThird = ""
vFourth = ""
vFifth = ""
vSixth = ""


    vName = Request.Form("txtName")
    vEmail = Request.Form("txtEmail")
    vPole = Request.Form("txtPole")
    vSecond in qualifying = Request.Form("txtSecond in qualifying")
    vThird in qualifying = Request.Form("txtThird in qualifying")
    vFourth in qualifying = Request.Form("txtFourth in qualifying")
    vFifth in qualifying = Request.Form("txtFifth in qualifying")
    vSixth in qualifying = Request.Form("txtSixth in qualifying")
    vRacewinner = Request.Form("txtRacewinner")
    vSecond = Request.Form("txtSecond")
    vThird = Request.Form("txtThird")
    vFourth = Request.Form("txtFourth")
    vFifth = Request.Form("txtFifth")
    vSixth = Request.Form("txtSixth")
    



    'Check if E-mail adrress is valid. 
        function isValidEmail(byval vEmail)
        ' very simple email validation function.
            returnVal = false
        if not isEmpty(vEmail) then
            if instr(vEmail, "@") > 0 and instr(vEmail, ".") > 0 then
                returnVal = true
            end if
        end if
        isValidEmail = returnVal
        end function 

    'Check if field is filled with data and if e-mail is correct
    
    if vName = "" then bName = false else bName = true end if
    if isValidEmail(vEmail) then bEmail = true else bEmail = false end if
    if vPole = "" then bPole = false else bpole = true end if
    if vSecond in qualifying = "" then bSecond in qualifying = false else bSecond in qualifying = true end if
    if vThird in qualifying = "" then bThird in qualifying = false else bThird in qualifying = true end if
    if vFourth in qualifying = "" then bFourth in qualifying = false else bFourth in qualifying = true end if
    if vFifth in qualifying = "" then bFifth in qualifying = false else bFifth in qualifying = true end if
    if vSixth in qualifying = "" then bSixth in qualifying = false else bSixth in qualifying = true end if
    if vRacewinner = "" then bRacewinner = false else bRacewinner = true end if
    if vSecond = "" then bSecond = false else bSecond = true end if
    if vThird = "" then bThird = false else bThird = true end if
    if vFourth = "" then bFourth = false else bFourth = true end if
    if vFifth = "" then bFifth = false else bFifth = true end if
    if vSixth = "" then bSixth = false else bSixth = true end if    
    
        
            bValidForm = True
            Name = Request.Form("txtName")
Email = Request.Form("txtEmail")
vPole = Request.Form("txtPole")
vSecond in qualifying = Request.Form("txtSecond in qualifying")
vThird in qualifying = Request.Form("txtThird in qualifying")
vFourth in qualifying = Request.Form("txtFourth in qualifying")
vFifth in qualifying = Request.Form("txtFifth in qualifying")
vSixth in qualifying = Request.Form("txtSixth in qualifying")
vRacewinner = Request.Form("txtRacewinner")
vSecond = Request.Form("txtSecond")
vThird = Request.Form("txtThird")
vFourth = Request.Form("txtFourth")
vFifth = Request.Form("txtFifth")
vSixth = Request.Form("txtSixth")
vPole = Request.Form("txtPole")




Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "smtp.casema.net" ' Specify a valid SMTP server
Mail.From = Email ' Specify sender's address
Mail.FromName = Name ' Specify sender's name

Mail.AddAddress "jacanja@casema.net" 
Mail.AddReplyTo Email


Mail.Subject = Subject
dim strBody
strBody = "Pole" & vbCrlf
strBody = strBody & "Second in qualifying" & vbCrLf
strBody = strBody & "Third in qualifying" & vbCrLf
strBody = strBody & "Fourth in qualifying" & vbCrLf
strBody = strBody & "Fifth in qualifying" & vbCrLf
strBody = strBody & "Sixth in qualifying" & vbCrLf
strBody = strBody & "Racewinner" & vbCrLf
strBody = strBody & "Second" & vbCrLf
strBody = strBody & "Third" & vbCrLf
strBody = strBody & "Fourth" & vbCrLf
strBody = strBody & "Fifth" & vbCrLf
strBody = strBody & "Sixth" & vbCrLf
Mail.Body = strBody

On Error Resume Next
Mail.Send
If Err <> 0 Then
   Response.Write "Error encountered: " & Err.Description
End If

Response.Redirect "SendSucces.asp"
        
        Else 
        
        bValidForm = False

        End If 

        If vTry = "" Then 
        vTry = "Second"
        Else 
        vTry = "Third"
        End If 

If Request.QueryString("Try") = "Second" or Request.QueryString("Try") = "" Then
%>  
        

<html>
<head>
<title>FeedbackForm.asp</title>

</head>
<body text="#000000">
<table width="600" border="0" cellspacing="0" cellpadding="0" height="50%">
  <tr> 
    <td width="502" valign="top" align="left"> <br>
    <br>
    <table width="94%" border="0" cellspacing="0" cellpadding="0" align="center">
      <tr> 
        <td> 
        <form name="FeedbackForm" method="post" action="FeedbackForm.asp?Try=<%=vTry%>">
          <table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
            <% if vTry = "Third" Then %>
            <tr> 
            <td colspan="2" height="30" class="txtGray">Please fill in the 
              <font color="#FF0000">red</font> marked fields. Thank you!</td>
            </tr>
            <% End If %>
            <tr> 
            <td width="33%" height="25"> <span class="txtbold"> 
              <% if bName = False and vTry = "Third" Then response.write "<font color=red>" end if %>
              Your Name 
              <% if bName = False and vTry = "Third" Then response.write "</font>" end if %>
              </span> </td>
            <td width="67%" height="25"> 
              <input type="text" name="txtName" value="<%= vName %>" class="txtField">
            </td>
            </tr>
            <tr> 
            <td width="33%" height="25"><span class="txtbold"> 
              <% if bEmail = False and vTry = "Third" Then response.write "<font color=red>" end if %>
              Your E-mail 
              <% if bEmail = False and vTry = "Third" Then response.write "</font>" end if %>
              </span> </td>
            <td width="67%" height="25"> 
              <input type="text" name="txtEmail" value="<%= vEmail %>" class="txtField">
            </td>
            </tr>
            <tr> 
            <td width="33%" height="25"> <span class="txtbold"> 
              <% if bSubject = False and vTry = "Third" Then response.write "<font color=red>" end if %>
              Subject 
              <% if bSubject = False and vTry = "Third" Then response.write "</font>" end if %>
              </span> </td>
            <td width="67%" height="25"> 
              <input type="text" name="txtSubject" value="<%= vSubject %>" class="txtField">
            </td>
            </tr>
            <tr> 
            <td width="33%" align="left" valign="middle" height="25"><span class="txtbold"> 
              <% if bMessage = False and vTry = "Third" Then response.write "<font color=red>" end if %>
              Message 
              <% if bMessage = False and vTry = "Third" Then response.write "</font>" end if %>
              </span> </td>
            <td width="67%"> 
              <textarea name="txtMessage" cols="50" rows="8" class="txtField"><%= vMessage %></textarea>
            </td>
            </tr>
            <tr> 
            <td width="33%">&nbsp;</td>
            <td width="67%"> <br>
              <input type="submit" name="Submit" value="Submit" class="btn">
              <input type="reset" name="Submit2" value="Reset" class="btn">
            </td>
            </tr>
          </table>
        </form>
        </td>
      </tr>
    </table>
    <br>
    <br>
    <br>
    <p> </p>
    <br>
    <p>&nbsp; </p>
    </td>
  </tr>
</table>
</body>
</html>

<%
Else 

If Request.QueryString ("Try") = "Third" Then
response.redirect "WrongData.asp"

End If
End If





%>

Verwijderd

krijg je nog een error dan? zoja, welke? verstuurt hij de mail goed, dan is er toch geen probleem?

edit:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
    vName = Request.Form("txtName")
    vEmail = Request.Form("txtEmail")
    vPole = Request.Form("txtPole")
    vSecond in qualifying = Request.Form("txtSecond in qualifying")
    vThird in qualifying = Request.Form("txtThird in qualifying")
    vFourth in qualifying = Request.Form("txtFourth in qualifying")
    vFifth in qualifying = Request.Form("txtFifth in qualifying")
    vSixth in qualifying = Request.Form("txtSixth in qualifying")
    vRacewinner = Request.Form("txtRacewinner")
    vSecond = Request.Form("txtSecond")
    vThird = Request.Form("txtThird")
    vFourth = Request.Form("txtFourth")
    vFifth = Request.Form("txtFifth")
    vSixth = Request.Form("txtSixth")

dit stuk staat ongeveer twee keer in je code, bovendien is de tweede keer Email en de eerste vEmail. Beetje zinloos.

edit2: je hebt oa een variabele "vFourth in qualifying" maar je kan echt geen variabelen met spaties hebben hoor! gebruik eventueel underscores, hoewel zo'n lange namen niet echt netjes zijn.

Zet trouwens eens de "friendly error messages" af in IE, dan zie je wat er fout is...
Pagina: 1