Solved

How do I send an email from a form using CDOSYS?

Posted on 2009-07-05
6
188 Views
Last Modified: 2012-05-07
I have a basic online form which I am trying to send email from. I can get it to work up to a certain point. My issue is with the body. The way I currently have it set up it only sends the last value processed which in this case is the "question" field. How do I put all of my form fields in an email? It doesn't have to be pretty so text format is fine. If HTML is easier than I can go that route to.
<%@ LANGUAGE="VBSCRIPT" %>    

<% response.buffer="true"%>
 
 
 

<%

Set myMail=CreateObject("CDO.Message")

myMail.Subject="Web Lead from JohnBartz.com"

myMail.From= Request.Form("Email")

myMail.To="dan@johnXXXXXX.com"

myMail.Cc="XXXXXXXX@gmail.com"

myMail.TextBody= "From: " & Trim(Request.Form("name"))& VBCrLf

myMail.TextBody= "Email Address: " & Trim(Request.Form("Email"))& VBCrLf

myMail.TextBody= "Company: " & Trim(Request.Form("company"))& VBCrLf

myMail.TextBody= "Phone: " & Trim(Request.Form("phone"))& VBCrLf

myMail.TextBody= "Question: " & Trim(Request.Form("question"))

myMail.Send

set myMail=nothing

Response.redirect "inquiry-thanks.html"

%>

Open in new window

0
Comment
Question by:futr_vision
  • 3
  • 2
6 Comments
 
LVL 30

Accepted Solution

by:
Wayne Barron earned 500 total points
ID: 24780728
see if this works for you

Carrzkiss
<%@ LANGUAGE="VBSCRIPT" %>    

<% response.buffer="true"%>

 

 

 

<%

Set myMail=CreateObject("CDO.Message")

myMail.Subject="Web Lead from JohnBartz.com"

myMail.From= Request.Form("Email")

myMail.To="dan@johnXXXXXX.com"

myMail.Cc="XXXXXXXXXXX@gmail.com"

myMail.TextBody= "From: " & Trim(Request.Form("name"))& VBCrLf

myMail.TextBody= myMail.TextBody &  "Email Address: " & Trim(Request.Form("Email"))& VBCrLf

myMail.TextBody= myMail.TextBody &  "Company: " & Trim(Request.Form("company"))& VBCrLf

myMail.TextBody= myMail.TextBody &  "Phone: " & Trim(Request.Form("phone"))& VBCrLf

myMail.TextBody= myMail.TextBody &  "Question: " & Trim(Request.Form("question"))

myMail.Send

set myMail=nothing

Response.redirect "inquiry-thanks.html"

%>

Open in new window

0
 
LVL 30

Expert Comment

by:Wayne Barron
ID: 24781406
I did not catch on to that, And have asked the mods to come in and remove
Your personal information from the post.
Should be taken care of shortly, they are usually pretty quick, as long as they
Are not all 4th of July out.. :)

Have a good one.
Carrzkiss
0
 

Author Comment

by:futr_vision
ID: 24781412
Thanks. One that is done I'll award the points.
0
 

Author Closing Comment

by:futr_vision
ID: 31599935
Thanks a bunch for a quick and complete answer.
0
 
LVL 30

Expert Comment

by:Wayne Barron
ID: 24782149
You are very welcome.
Have a great evening.

Carrzkiss
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
Local Continuous Replication is a cost effective and quick way of backing up Exchange server data. The following article describes the steps required to configure Local Continuous Replication. Also, the article tells you how to restore from a backup…
In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
The basic steps you have just learned will be implemented in this video. The basic steps are shown to configure an Exchange DAG in a live working Exchange Server Environment and manage the same (Exchange Server 2010 Software is used in a Windows Ser…

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now