User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the ASP section within the Web Development category of DaniWeb, a massive community of 375,245 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,246 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our ASP advertiser: Lunarpages ASP Web Hosting

Use of ASP, mailforms, & Dreamweaver

Join Date: Sep 2004
Location: Plymouth, UK
Posts: 79
Reputation: msaqib is an unknown quantity at this point 
Rep Power: 4
Solved Threads: 1
msaqib msaqib is offline Offline
Junior Poster in Training

Re: Use of ASP, mailforms, & Dreamweaver

  #2  
Mar 23rd, 2006
Hello,
Here is a simple email function which you can use to send the emails from the web forms. For the spam i would suggest you not to disclose that page to the search bots. You can hide the direct html link of that page and use the javascript, so that only the visitor can access that page by clicking on the link. i.e.
<a href="#" onclick="window.open('url')">Email Form</a>

And here is the ASP function to use.

Function Sendmail(MailFromAddr, RecipientAddr, cSubject, strMsgInfo, sCc, sBcc, iPriority, RecipientName, cMailHost,cMailFromName,attachment,HTMLMail) 

IF instr(strMsgInfo,"<")<>0 then ' This is HTML content

HTMLMail=true

ELSE

HTMLMail=false

END IF



On Error Resume Next

'Dimension variables

Dim objCDOSYSCon



'Create the e-mail server object

Set objCDOSYSMail = Server.CreateObject("CDO.Message")

Set objCDOSYSCon = Server.CreateObject ("CDO.Configuration")



'Set and update fields properties

'Out going SMTP server

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost

'SMTP port

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

'CDO Port

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

'Timeout

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 600

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername") = "username"

objCDOSYSCon.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password

objCDOSYSCon.Fields.Update 



'Update the CDOSYS Configuration

Set objCDOSYSMail.Configuration = objCDOSYSCon





'Who the e-mail is from

objCDOSYSMail.From = "<" & MailFromAddr& ">"



'mail carbon copy

objCDOSYSMail.Cc = "<" & sCc & ">"



objCDOSYSMail.Bcc = "<" & sBcc & ">"



'Who the e-mail is sent to

objCDOSYSMail.To = "<" & RecipientAddr& ">"



'The subject of the e-mail

objCDOSYSMail.Subject = cSubject



If CBool( HTMLMail ) Then



objCDOSYSMail.HTMLBody = strMsgInfo

Else

objCDOSYSMail.TextBody = strMsgInfo

End If 

'Send the e-mail

objCDOSYSMail.Send 



'Close the server mail object

Set objCDOSYSMail = Nothing
End Function
Reply With Quote  
All times are GMT -4. The time now is 4:41 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC