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 > newsletter problem sending emails...

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-21-03, 18:17
blondini3 blondini3 is offline
Registered User
 
Join Date: Feb 2003
Location: new zealand
Posts: 17
newsletter problem sending emails...

Hi there all,

if sorted out the below problem by this: you must enter a valid email address into the FROM field on the form !Duh.

I have a form submitting the message body to a list of email addresses. It all runs smoothly, except the actual email doesn't get sent...

the code below is for the createnewsletter.asp page, receving the 'from' , 'subject' , and 'message' fields from a form on a previous page......

but I think the problem is in this code below that is actually meant to SEND the email........I'm not getting any error messages.



<%
'our constants
Const adOpenKeyset = 1
Const adLockReadOnly = 1
Const adCmdTable = &H0002
'our variables for the email and for our objects
Dim strTo , strFrom , strSubject , strBody , objCDONTS , objRS , objConn
'get the results from the create newsletter form
strFrom = Request.Form("from")
strSubject = Request.Form("subject")
strBody = Request.Form("message")
Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "DBQ=" & Server.MapPath("../jjdendb/newsletter.mdb")& ";Driver={Microsoft Access Driver (*.mdb)}"
Set objRS = Server.CreateObject("ADODB.RecordSet")
objRS.Open "email" , objConn ,adOpenKeyset ,adLockReadOnly,adCmdTable
'just a message to the admin
Response.Write ("Newsletters are being created")
response.Write ("<br>")
'loop through entries
While not objRS.EOF
'create an instance of the CDONTS object
Set objCDONTS = Server.CreateObject("CDONTS.NewMail")
'set objCDONTS various properties
objCDONTS.From = strFrom
objCDONTS.To = objRS("email")
objCDONTS.Subject = strSubject
objCDONTS.Body = strBody
objCDONTS.Send
Set objCDONTS = Nothing
'print message for every entry
Response.Write ("message sent to " & objRS("email") & "<br>")
'move to next entry in database
objRS.MoveNext
Wend
'message to admin saying creation has completed
Response.Write ("newsletter creation completed ")
%>

can anyone help ??
thanks heaps..
Angie.

Last edited by blondini3; 05-21-03 at 18:30.
Reply With Quote
  #2 (permalink)  
Old 05-21-03, 22:15
MrWizard MrWizard is offline
Registered User
 
Join Date: Mar 2003
Location: Atlanta, GA
Posts: 191
Re: newsletter problem sending emails...

I don't see anything that hits me. Sometimes, email components are installed but don't actually send emails if configured incorrectly.

Are you certain CDONTS is properly configured. I've known of at least a few situations where a reinstall of the OS or sometimes just a reboot of the Exchange server solved similar problems.

Personally, I would try AspMail or AspEMail components. They're free, and offer a lot more functionality.

Finally, for some code that DOES work, download the test file at

http://www.pensaworks.com/prg_com.asp?v=3

there are 2 test files in the Zip file, one of which is a mailer test file, and tests for existance and correct configuration of several email components (including CDONTS) on the server.

Tim
__________________
Tim
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