Programming and Webmasters forum
HomeSearchRecent PostsLoginRegister Contact Us

Username  
Password
Announcing 14th Weekly Contest - From 25 July To 01 August.

Win every week on this forum.

Chek out How To Win?
 

Pages: [1]   Go Down
 
  Email this topic  |  Print
0 Members and 2 Guests are viewing this topic.

Sending email Using asp

 
webmaster forum
hardy  Offline
Contest Points: 100
 
New Coder
Posts: 25
Topics: 16
December 17, 2008, 10:51:23 PM

I have heard that we can use cdonts component to send email using asp, can anyone tell me where will I get code so that I can make contact us form in asp which sends email to me when user submit a form?

Thanks
 
webmaster forum
Kailash  Offline
Contest Points: 100
 
New Coder
Posts: 31
Topics: 10
December 19, 2008, 12:31:52 PM

Yes, you can use CDONTS ASP component to send mail using ASP. Below is the sample code which you can use to send mail:
   
Code:
<%
      Set objMail = Server.CreateObject("CDONTS.NewMail")

      objMail.To = “Name <email@domain.com>”
      objMail.From = “Name<email@domain.com>”
      objMail.Subject = “CDONTS Sample Script”

      BodyText = “This is a test email.” & vbCRLF
      BodyText = BodyText & “It was sent using CDONTS”  & vbCRLF
      BodyText = BodyText & vbCRLF

      objMail.Body = BodyText
      objMail.AttachFile “c:\attachfile.txt”  // For Attachment

      objMail.Send
%>

Also it is recommended you validate all input values before it send mail.

Kailash
 
webmaster forum
Anchor  Offline
Contest Points: 100
 
New Coder
Posts: 20
Topics: 16
January 11, 2009, 09:53:17 AM

I'm guessing the emails are getting flagged as spam because that's exactly what they are? lol
 
webmaster forum
polas  Offline
*
 
Hacker
Gender: Male
Posts: 1224
Topics: 78
WWW
January 11, 2009, 10:48:38 AM

I'm guessing the emails are getting flagged as spam because that's exactly what they are?

I suppose it depends on what they use the script for - if the OP wants to allow his website visitors to send him a message then he can always tweak his junk filter to allow that sort of message to arrive

Mesham Type Oriented Parallel Programming Language
Skydive in North East England
 
webmaster forum
Jennifer Linn
Contest Points: 100
 
New Coder
Location: UK
Gender: Female
Age: 24
Posts: 22
Topics: 5
WWW
March 16, 2009, 10:48:39 PM

Sub SendMailCDONTS(aTo, Subject, TextBody, aFrom)
  Const CdoBodyFormatText = 1
  Const CdoBodyFormatHTML = 0
  Const CdoMailFormatMime = 0
  Const CdoMailFormatText = 1
  Dim Message 'As New cdonts.NewMail
 
  'Create CDO message object
  Set Message = CreateObject("cdonts.NewMail")
  With Message
   
    'Set email adress, subject And body
    .To = aTo
    .Subject = Subject
    .Body = TextBody
   
    'set mail And body format
    .MailFormat = CdoMailFormatText
    .BodyFormat = CdoBodyFormatText
   
    'Set sender address If specified.
    If Len(aFrom) > 0 Then .From = aFrom
   
    'Send the message
    .Send
  End With
End Sub
***********************************************************************************************************************

Sending email using CDOSYS
<%
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
%>

Service Management Software
 
webmaster forum
polas  Offline
*
 
Hacker
Gender: Male
Posts: 1224
Topics: 78
WWW
March 19, 2009, 12:40:37 PM

Excellent, thanks for posting that Smiley

Mesham Type Oriented Parallel Programming Language
Skydive in North East England
 
webmaster forum
Contest Points: 100
 
New Coder
Posts: 10
Topics: 2
March 03, 2010, 07:06:07 AM

great----------- thanks for sharing this thread. 

croatia apartments
 
webmaster forum
singam  Offline
Contest Points: 100
 
New Coder
Posts: 39
Topics: 15
July 15, 2010, 03:42:03 AM

Well, you can make your form manually in HTML, Javascript, PHP. But once you SUBMIT your form, all the information in it has to be processed on the server (either if you need to store info on a db, or whatever the case.)
If your issue consists in not using PHP, then you can use ASP.NET, or ASP, etc; but you have to use a server platform to process your forms.

In this case, you say it's a contact form, that's you write a mail then you submit the form a mail address. In a normal situation, when you submit that form, another server page (i.e. made in PHP) usually takes that info (username, destination address, subject, mail content) and calls server functions to send the mail. That kind of things can't be done in Javascript because Javascript runs on people's browsers. Javascript is client-side. PHP, ASP, ASP.NET, are server-side.
=================

New Homes | Cheap Flights

 
  Email this topic  |  Print
Pages: [1]   Go Up
 
Jump to:  



Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC


Google visited last this page July 22, 2010, 07:19:19 PM

Valid XHTML 1.0 Transitional     Valid XHTML 1.0 Transitional