Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Sending form to Emai using ASP

New Here ,
Dec 23, 2007 Dec 23, 2007
here is my script
it seems as though it works (it redirects to the "Thanks" page) however when i check my meail, i recieve nothing


<%
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim FirstName
Dim LastName
Dim month
Dim day
Dim year
Dim email

' get posted data into variables
EmailFrom = Trim(Request.Form("email"))
EmailTo = "admin@dropinfitness.com"
Subject = "Every Internet Game Guestlist"
fname = Trim(Request.Form("fname"))
lname = Trim(Request.Form("lname"))
month = Trim(Request.Form("month"))
day = Trim(Request.Form("day"))
year = Trim(Request.Form("year"))
email = Trim(Request.Form("email"))

' prepare email body text
Dim Body
Body = Body & "fname: " & fname & VbCrLf
Body = Body & "lname: " & lname & VbCrLf
Body = Body & "month: " & month & VbCrLf
Body = Body & "day: " & day & VbCrLf
Body = Body & "year: " & year & VbCrLf
Body = Body & "email: " & email & VbCrLf

' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send

' redirect to success page
Response.Redirect("Thanks.html?" & EmailFrom)
%>
TOPICS
Server side applications
835
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Dec 23, 2007 Dec 23, 2007
I am new to this so I'm not sure, but I have heard/read that sometimes e-mail tested on a local server does not actually go through. Are you testing locally or on a remote server?

Glenn
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 23, 2007 Dec 23, 2007
i am not testing
i am running in on the remote server
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 26, 2007 Dec 26, 2007
please help me
i am losing myself
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Dec 29, 2007 Dec 29, 2007
Sometime emails gets blocked by the receiving server (happened to me couple of times). Either try sending to other free web based email accounts or check smtp server settings from administrator.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 29, 2007 Dec 29, 2007
On any new asp server using Cdonts and Microsoft lost their minds with asp.net 2 or 3 and all my Cdonts emails stopped working too. I have always had to CRAM in this code for it to work. Has something to do with asp .net on windows servers I have no clue what it does but it works. This is the code for a normal .asp/cdonts email I use good luck.

<%
sch = " http://schemas.microsoft.com/cdo/configuration/"
Set cdoConfig = Server.CreateObject("CDO.Configuration")
With cdoConfig.Fields
.Item(sch & "sendusing") = 2 ' cdoSendUsingPort
.Item(sch & "smtpserver") = "127.0.0.1"
.update
End With

Set objMail = Server.CreateObject("CDO.Message")
Set objMail.Configuration = cdoConfig
objMail.From = "youremail@yoursite,com"
objMail.To = "youremail@yoursite,com"
objMail.Cc = "youremail@yoursite,com"
objMail.Subject = "Test test test"
objMail.TextBody = "Hi your name here," & VbCrLf
& "This is a test " &
VbCrLf & VbCrLf
& "more text for the test"

objMail.Send
Set objMail = Nothing
Set cdoConfig = Nothing
Response.Redirect("yourpage.asp")
%>

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jan 02, 2008 Jan 02, 2008
quote:

Originally posted by: cjamesc
here is my script
it seems as though it works (it redirects to the "Thanks" page) however when i check my meail, i recieve nothing


<%
' declare variables
Dim EmailFrom
Dim EmailTo
Dim Subject
Dim FirstName
Dim LastName
Dim month
Dim day
Dim year
Dim email

' get posted data into variables
EmailFrom = Trim(Request.Form("email"))
EmailTo = "admin@dropinfitness.com"
Subject = "Every Internet Game Guestlist"
fname = Trim(Request.Form("fname"))
lname = Trim(Request.Form("lname"))
month = Trim(Request.Form("month"))
day = Trim(Request.Form("day"))
year = Trim(Request.Form("year"))
email = Trim(Request.Form("email"))

' prepare email body text
Dim Body
Body = Body & "fname: " & fname & VbCrLf
Body = Body & "lname: " & lname & VbCrLf
Body = Body & "month: " & month & VbCrLf
Body = Body & "day: " & day & VbCrLf
Body = Body & "year: " & year & VbCrLf
Body = Body & "email: " & email & VbCrLf

' send email
Dim mail
Set mail = Server.CreateObject("CDONTS.NewMail")
mail.To = EmailTo
mail.From = EmailFrom
mail.Subject = Subject
mail.Body = Body
mail.Send

' redirect to success page
Response.Redirect("Thanks.html?" & EmailFrom)
%>



when it redirect to your thanks page, it meant your setting shouldn't have any problems. You are losing the coding part. This should help.
http://authors.aspalliance.com/das/tutorial/email.aspx
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 03, 2008 Jan 03, 2008
LATEST
cjamesc wrote:
> here is my script
> it seems as though it works (it redirects to the "Thanks" page) however when i
> check my meail, i recieve nothing
>
>
> <%
> ' declare variables
> Dim EmailFrom
> Dim EmailTo
> Dim Subject
> Dim FirstName
> Dim LastName
> Dim month
> Dim day
> Dim year
> Dim email
>
> ' get posted data into variables
> EmailFrom = Trim(Request.Form("email"))
> EmailTo = "admin@dropinfitness.com"
> Subject = "Every Internet Game Guestlist"
> fname = Trim(Request.Form("fname"))
> lname = Trim(Request.Form("lname"))
> month = Trim(Request.Form("month"))
> day = Trim(Request.Form("day"))
> year = Trim(Request.Form("year"))
> email = Trim(Request.Form("email"))
>
> ' prepare email body text
> Dim Body
> Body = Body & "fname: " & fname & VbCrLf
> Body = Body & "lname: " & lname & VbCrLf
> Body = Body & "month: " & month & VbCrLf
> Body = Body & "day: " & day & VbCrLf
> Body = Body & "year: " & year & VbCrLf
> Body = Body & "email: " & email & VbCrLf
>
> ' send email
> Dim mail
> Set mail = Server.CreateObject("CDONTS.NewMail")
> mail.To = EmailTo
> mail.From = EmailFrom
> mail.Subject = Subject
> mail.Body = Body
> mail.Send
>
> ' redirect to success page
> Response.Redirect("Thanks.html?" & EmailFrom)
> %>

Your using CDONTS, which server are you using this on? I have a Win2K3
server, and these do not come with CDONTS installed, it has CDOSYS
instead. If you want CDONTS you have to find the DLL on the internet and
register it. You also need to make sure that IIS has SMTP setup
correctly too.

Steve
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines