Go Back   DeveloperBarn Forums > Programming & Scripting > ASP Development

Sponsored Links

Discuss "Simple way to email form" in the ASP Development forum.

ASP Development - Learn coding practices and tips to get the best out of your Active Server Pages (ASP). The Classic ASP forum is for ASP/VBScript and ASP/JScript applications.


Closed Thread « Previous Thread | Next Thread »
 
LinkBack Thread Tools Display Modes
  #1  
Old July 14th, 2008, 11:00 AM
Rebelle's Avatar
V.I.P/Donor


 
Join Date: Mar 2008
Posts: 254
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Question Simple way to email form

Hi All,

I'm going to be creating a new form using asp that will update a sql database but would like to know what is a simple way to email the form info using ASP. I've googled but found only in php. Should send email at the same time of updating the database.....


Thanks in advance for your help!

Last edited by Rebelle; July 14th, 2008 at 11:18 AM.
Sponsored Links
  #2  
Old July 14th, 2008, 11:07 AM
Barn Newbie
 
Join Date: Jul 2008
Location: Hayes, Middlesex, UK
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 1
icoombs is on a distinguished road

Awards Showcase
Classic ASP 
Total Awards: 1

Default

You need to know what system your site is hosted on, Windows or Linux as the methods are different, also you can check out you hosts FAQ and see what method they say for sending mail.
  #3  
Old July 14th, 2008, 11:10 AM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 818
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft .Net Microsoft SQL Server Microsoft Windows Classic ASP 
Total Awards: 4

Default

Belle - Run this script on your server to see which of these common mail components you have: http://www.developerbarn.com/classic...nent-test.html

Once you know what component you have available, do a Google search on that specific component to learn how to use it.
__________________
jmurrayhead
If you agree with me... click the icon!
If my post solved your problem, click the button in the lower right-hand corner of the post.

Join our Folding team: DeveloperBarn Folding
The Following User Says Thank You to jmurrayhead For This Useful Post:
Rebelle (August 14th, 2008)
  #4  
Old July 14th, 2008, 11:12 AM
Barn Newbie
 
Join Date: Jul 2008
Location: Hayes, Middlesex, UK
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 1
icoombs is on a distinguished road

Awards Showcase
Classic ASP 
Total Awards: 1

Default

If your on a Windows based host you should be able to use

Code:
 
  Set objCDOSYSMail = Server.CreateObject("CDO.Message")
  Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/con...ion/smtpserver") = "SMTP SERVER ADDRESS"
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/con...smtpserverport")  = 25 
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/con...tion/sendusing") = 2 
  objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/con...nectiontimeout") = 60 
  objCDOSYSCon.Fields.Update 
  Set objCDOSYSMail.Configuration = objCDOSYSCon
  objCDOSYSMail.From = strFromName & " <" & strFromEmail & ">"
  objCDOSYSMail.Cc = strFromName & " <" & strFromEmail & ">"
  objCDOSYSMail.To = strToEmail
  objCDOSYSMail.Subject = strSubject
  objCDOSYSMail.HTMLBody = strBody
  objCDOSYSMail.Send 
  Set objCDOSYSMail = Nothing
  Set objCDOSYSCon = Nothing
The Following User Says Thank You to icoombs For This Useful Post:
Rebelle (August 14th, 2008)
  #5  
Old July 14th, 2008, 11:28 AM
Rebelle's Avatar
V.I.P/Donor


 
Join Date: Mar 2008
Posts: 254
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

okies....thanks, this is what the result is....I'll google away.

Testing CDONTS mail component...
This component is available on this server.


Testing JMail component...
This component is not available on this server.


Testing ASPEmail component...
This component is not available on this server.


Testing CDO mail component...
This component is available on this server.
  #6  
Old July 14th, 2008, 11:34 AM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 818
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft .Net Microsoft SQL Server Microsoft Windows Classic ASP 
Total Awards: 4

Default

In that case, here's a very simple example:

Code:
<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mymail@mydomain.com"
myMail.To="someone@somedomain.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>
Found here: ASP Sending e-mail with CDOSYS

Comments on this post
BLaaaaaaaaaarche agrees:
  #7  
Old July 23rd, 2008, 02:36 PM
Rebelle's Avatar
V.I.P/Donor


 
Join Date: Mar 2008
Posts: 254
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

Hiya,

I tried the code in post above but running into the following error:

Code:
CDO.Message.1 error '80040220' 

The "SendUsing" configuration value is invalid.
Do I need an stmp mail server line?

or is this error something else I'm doing incorrectly?

Line in red.
Code:
Dim myMail
Set myMail = createObject("CDO.Message")
myMail.Subject="a new form has just been submitted"
myMail.From="xxx@company.com"
myMail.To="yyy@company.com"
myMail.TextBody="this is a test"
myMail.Send

Set myMail=nothing

Last edited by Rebelle; July 23rd, 2008 at 02:39 PM. Reason: added code for code in red!
  #8  
Old July 23rd, 2008, 02:48 PM
jmurrayhead's Avatar
The Barnfather

 
Join Date: Mar 2008
Location: Reston, VA, USA
Posts: 818
Thanks: 20
Thanked 74 Times in 71 Posts
Blog Entries: 5
Rep Power: 3
jmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura aboutjmurrayhead has a spectacular aura about

Awards Showcase
Microsoft .Net Microsoft SQL Server Microsoft Windows Classic ASP 
Total Awards: 4

Default

Try Icoombs example
  #9  
Old July 28th, 2008, 11:42 AM
Rebelle's Avatar
V.I.P/Donor


 
Join Date: Mar 2008
Posts: 254
Thanks: 48
Thanked 1 Time in 1 Post
Rep Power: 1
Rebelle is on a distinguished road
Default

with icoombs example, i get the following error:

Code:
CDO.Message.1 error '80040213' 

The transport failed to connect to the server.
I'm still trying to make sure I have the correct server info here.... is there another way i can test to see if email will work for my server?
  #10  
Old July 28th, 2008, 12:05 PM
Barn Newbie
 
Join Date: Jul 2008
Location: Hayes, Middlesex, UK
Posts: 8
Thanks: 0
Thanked 2 Times in 2 Posts
Rep Power: 1
icoombs is on a distinguished road

Awards Showcase
Classic ASP 
Total Awards: 1

Default

Check with your host, they may have a FAQ or you will have to contact them.
Closed Thread

  DeveloperBarn Forums > Programming & Scripting > ASP Development

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Basic Tools] An intro to making complex databases using simple methods. sbenj69 Microsoft Access 3 June 27th, 2008 12:09 AM
send Bulk email peebman2000 .Net Development 2 June 20th, 2008 10:06 AM
[ASP/VBScript] ASP/VBScript Simple Mail Component Test jmurrayhead Code Samples 0 March 20th, 2008 09:47 AM


All times are GMT -4. The time now is 02:47 PM.



Content Relevant URLs by vBSEO 3.2.0