If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > ASP mail and CDONTS - check my code please ?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 06-22-03, 17:42
gilesb gilesb is offline
Registered User
 
Join Date: Feb 2003
Posts: 8
ASP mail and CDONTS - check my code please ?

HI all,

i am actually sending data to this ASP page from a flash file - i know the data is getting to the page and i have a flag variable sent back to my flash file telling me the script has run - but the script does NOT appear to be sending the email.

i am sending variables representing the name, email address, subject and message of the user.

I know it works on my servers at work, but the NOT on the hosting company's servers - i have asked them and they say that CDONTS should work no problem

can someone check this code for me

many thanks in advance

-----------------------------------
<%
language = "vbscript"
response.buffer = true

dim mtext01, mtext02, mtext03, mtext04

mtext01 = "Name:" & request.form("name") & vbcrlf
mtext02 = "Email:" & request.form("email") & vbcrlf
mtext03 = "Comments: " & request.form("message") & vbcrlf
mtext04 = request.form("subject")

mtextz = mtext01 & mtext02 & mtext03

dim MailObj
set MailObj = server.CreateObject("CDONTS.NewMail")

if request.form("email") = "" then
mailObj.From = "No name"
else
mailObj.From = request.Form("email")
end if

mailObj.To = "myEmail@myDomain.com"
mailObj.Body = mtextz
mailObj.Subject = mtext04
mailObj.Send
set MailObj = nothing
response.write "&emailStatus=E-mail sent successfully"
%>
---------------------------------

What would i need to ask the hosting company?

i know it works on my win2k servers at work but not at the hosting company

???

thanks in advance

gilesb
Reply With Quote
  #2 (permalink)  
Old 06-24-03, 00:07
Bullschmidt Bullschmidt is offline
Guru
 
Join Date: Jun 2003
Location: USA
Posts: 1,032
Try using CDO instead of CDONTS which is getting phased out.

You can look over the E-mail Attachment example at http://www.asp101.com/samples
__________________
J. Paul Schmidt, Freelance Web and Database Developer
www.Bullschmidt.com
Access Database Sample, Web Database Sample, ASP Design Tips
Reply With Quote
  #3 (permalink)  
Old 07-01-03, 04:51
JonathanB JonathanB is offline
Registered User
 
Join Date: Feb 2002
Location: North Wales, UK
Posts: 114
I notice that you are setting the "From:" to the value of a variable. If could be that your host does not allow e-mails to be sent out from addresses that it doesn't know about (i.e. domains that it doesn't host).

Try hard coding the "From:" field to an e-mail address on your domain and see if the e-mail get's sent.
__________________
J^ - web | email
newsASP Developer
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On