Programming and Webmasters forum
HomeSearchRecent PostsLoginRegister Contact Us
 

Username  
Password
Pages: [1]   Go Down
  Email this topic  |  Print
0 Members and 1 Guest are viewing this topic.

Sending email Using asp

 
webmaster forum
hardy  Offline
 
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
 
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
 
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: 1172
Topics: 77
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
 
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: 1172
Topics: 77
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
 
New Coder
Posts: 10
Topics: 2
March 03, 2010, 07:06:07 AM

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

croatia apartments
 
  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 March 05, 2010, 02:30:28 PM

Valid XHTML 1.0 Transitional     Valid XHTML 1.0 Transitional