![]() |
| ASPMail - Newbie Questions |
|
surge42
|
What's up guys,
I'm a newbie to ASP codes (I've been weened on Linux boxes) and I'm trying to get my head wrapped around how the ASPMail works. The instructions located here http://www.hostmysite.com/support/programming/aspmail/ say that in order to send specific information as an email from your website you will need to add the following block of code. - - The code is listed below - - <SNIP> <% Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.FromName = "website" Mailer.FromAddress= "user@yourdomain.com" Mailer.RemoteHost = "mail.yourdomain.com" Mailer.AddRecipient "Name", "name@yourdomain.com" Mailer.AddExtraHeader "X-MimeOLE:Produced yourdomain.com" Mailer.Subject = "Form Submission" Mailer.BodyText = "Enter the body of the message here." if Mailer.SendMail then Response.Write "Form information submitted..." else Response.Write "Mail send failure. Error was " & Mailer.Response end if set Mailer = Nothing %> <END SNIP> MY ASSUMPTIONS: I'm assuming that this script goes inside the HTML document. Is this correct? I'm also assuming that the script gets placed within the head of the document. Is this correct? Now the instructions say that to send the results of a form as an email from your website you will need to first create the HTML form. Within the form you will need to set the action to the page containing your ASPMail code. For example: <form action="aspmailform.asp" method="post"> Ok I get it.. Next, you will need to create the ASP page specified in the action which will contain the ASPMail code. You will start with the above form and replace the Mailer.BodyText line with the following: <SNIP> strMsgHeader = "Form information follows" & vbCrLf for each qryItem in Request.Form strMsgInfo = strMsgInfo & qryItem & " - " & request.Form(qryItem) & vbCrLf next strMsgFooter = vbCrLf & "End of form information" Mailer.BodyText = strMsgHeader & strMsgInfo & strMsgFooter <END SNIP> WAIT A SEC THIS IS THE PART THAT CONFUSES ME! We are talking about creating a aspmailform.asp file that we post to the server right? In other words, when the user clicks the send key that data gets sent to aspmailform.asp. Right? If this is true why are the instructions telling me to create an asp file and then in the next sentence to alter the html document code. Can any one provide a link to their working form mailer page so I can see how this thing actually works? FYI: I'm using Dreamweaver not FontPage. Thanks |
||||||||||||
|
|
|||||||||||||
|
cheryl
|
Hi Surge. You will create the aspmailform.asp page and put the code for the aspmail in it. So,
<SNIP> <% Set Mailer = Server.CreateObject("SMTPsvg.Mailer") Mailer.FromName = "website" Mailer.FromAddress= "user@yourdomain.com" Mailer.RemoteHost = "mail.yourdomain.com" Mailer.AddRecipient "Name", "name@yourdomain.com" Mailer.AddExtraHeader "X-MimeOLE:Produced yourdomain.com" Mailer.Subject = "Form Submission" Mailer.BodyText = "Enter the body of the message here." if Mailer.SendMail then Response.Write "Form information submitted..." else Response.Write "Mail send failure. Error was " & Mailer.Response end if set Mailer = Nothing %> <END SNIP> goes in aspmailform.asp In your html page, that actually shows the code, you need to change the form action so that the form posts to the aspmailform.asp page that actually does the aspmail call. I hope this clarifies it a bit for you - if not, let me know! |
||||||||||||
|
|
|||||||||||||
| ASPMail - Newbie Questions |
|
||
|


