Report abuse

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

' get posted data into variables
EmailFrom = Trim(Request.Form("Email")) 
EmailTo = "you@yourmail.com"
Subject = Trim(Request.Form("Subject")) 
FirstName = Trim(Request.Form("FirstName")) 
LastName = Trim(Request.Form("LastName")) 
Company = Trim(Request.Form("Company")) 
Message = Trim(Request.Form("Message")) 


' prepare email body text
Dim Body
Body = Body & "FirstName: " & FirstName & VbCrLf
Body = Body & "LastName: " & LastName & VbCrLf
Body = Body & "Email: " & Email & VbCrLf
Body = Body & "Company: " & Company & VbCrLf
Body = Body & "Subject: " & Subject & VbCrLf
Body = Body & "Message: " & Message & VbCrLf


' send email 
Set myMail=CreateObject("CDO.Message")
myMail.Subject=Subject
myMail.From=EmailFrom
myMail.To=EmailTo
myMail.TextBody=Body
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
'Name or IP of remote SMTP server
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver")="smtp.server.com"
'Server port
myMail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25
myMail.Configuration.Fields.Update
myMail.Send
set myMail=nothing


' redirect to success page 
if Err then
Response.Write "Result=Failed&"
Else
Response.Write "Result=Success&"
End If
%>