Wrox Programmer Forums
|
BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4
This is the forum to discuss the Wrox book Beginning Dreamweaver MX by Charles E. Brown, Imar Spaanjaars, Todd Marks; ISBN: 9780764544040
Please indicate which version of the book you are using when posting questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 19th, 2003, 08:04 AM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to tyson Send a message via MSN to tyson
Default Chapter 7 Forms

    Hi I was able to get the Form or the next page to say thank you for your interest with the info from the field but my question is how do I get the info to be e-mailed to me am I missing something please help please

 
Old July 19th, 2003, 12:09 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Tyson,

The book does not show you how to send the actual e-mail. The purpose of the forms chapter is to show you how to work with forms and form elements ans how to send information to the server.

However, to send an e-mail, you can use the following code:

Code:
Dim objMsg
Set objMsg = Server.CreateObject("CDONTS.NewMail")
'---- BodyFormat Property ----
Const CdoBodyFormatHTML = 0 ' The Body property is to include
                            ' Hypertext Markup Language (HTML).
Const CdoBodyFormatText = 1 ' The Body property is to be  
                            ' exclusively in plain text 
                            ' (default value).
'---- MailFormat Property ----
Const CdoMailFormatMime = 0 ' The NewMail object is to be in
                            ' MIME format.
Const CdoMailFormatText = 1 ' The NewMail object is to be in 
                            ' uninterrupted plain text 
                            ' (default value).

With objMsg
    .To = "[email protected]"
    .From = "[email protected]"
    .Subject = "The subject of the message"
    .BodyFormat = CdoBodyFormatText ' or CdoBodyFormatHTML
    .MailFormat = CdoMailFormatMime ' or CdoMailFormatText
    .Body = "The body text"
    .Send
End with
Set objMsg = Nothing
For this code to work, the local machine needs an SMTP server installed. Windows Server editions (NT4, 2000 etc) come with this SMTP server. Be sure to read the documents carefully, as opening an SMTP server without the proper configuration, might open up your server as a spam sending machine.

HtH,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 19th, 2003, 03:08 PM
Registered User
 
Join Date: Jul 2003
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to tyson Send a message via MSN to tyson
Default

I am so grateful for your answer however I am more lost then ever where do I put my email address to receive this form info and most important what page does this code go on to the html or the .asp I am so new but I am on the web does that do anything I just want the of what the person wrote nothing fancy no reply just a simple email from the customer thank you so much.


 
Old July 19th, 2003, 03:57 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Tyson,

Are you aware of an invention called "the dot"? They are usually used at the end of a sentence, making your posts easier to read ;)

Just kidding. Anyway, if you are really new to all this, setting up your own SMTP server might be quite some trouble, and difficult to explain in a forum.

To learn how to install and set up your own SMTP server, take a look at this article.

Alternatively, you can decide to use a third-part component that allows you to set the SMTP server of your provider (like smtp.YourProvider.com)

There are some free components available, including ASP Email. Take some time to read the documentation. There is lots of sample code and help available.

If you consider the example on page 250 of the book, here's how your code could look (notice I am still using the CDONTS.NewMail object I showed you earlier:

If strContact = "email" then
  ' It used to say Response.Write("We will email.... etc")
  but I replaced that with the e-mail code

  Dim objMsg
  Set objMsg = Server.CreateObject("CDONTS.NewMail")
  '---- BodyFormat Property ----
  Const CdoBodyFormatHTML = 0 ' The Body property is to include
                              ' Hypertext Markup Language (HTML).
  Const CdoBodyFormatText = 1 ' The Body property is to be
                              ' exclusively in plain text
                              ' (default value).
  '---- MailFormat Property ----
  Const CdoMailFormatMime = 0 ' The NewMail object is to be in
                              ' MIME format.
  Const CdoMailFormatText = 1 ' The NewMail object is to be in
                              ' uninterrupted plain text
                              ' (default value).
  With objMsg
      .To = strEmail
      .From = "[email protected]"
      .Subject = "The subject of the message"
      .BodyFormat = CdoBodyFormatText ' or CdoBodyFormatHTML
      .MailFormat = CdoMailFormatMime ' or CdoMailFormatText
      .Body = "Thanks for your response on our website bla bla bla."
      .Send
  End with
  Set objMsg = Nothing
End If

Hope this clarifies things a bit.

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 19th, 2003, 08:26 PM
Authorized User
 
Join Date: Jul 2003
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to chabrown Send a message via MSN to chabrown
Default

Tyson:

There is a fast and dirty way to get a form to email. You can set the action as mailto:name@domain (just plug in the email address you want) and set the Enctype to plain/text.

Be careful, this does not work in all browsers and email systems. That is why we decided to not include this in the book.

Charles E. Brown
Author - Beginning Dreamweaver MX, Fireworks MX - Zero to Hero
Contributor - Macromedia Studio MX Bible





Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 17 Web Forms phenom BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 11 August 6th, 2010 08:25 AM
Web Forms - Chapter 17 lana BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 July 23rd, 2008 04:52 PM
Chapter 13 - Forms as objects Zave BOOK: Access 2007 VBA Programmer's Reference ISBN: 978-0-470-04703-3 0 August 22nd, 2007 12:23 AM
Chapter 20 -Forms based Authentication bshay BOOK: Beginning ASP.NET 1.0 2 October 7th, 2003 09:17 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.