Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cannot get CDONTS to work I recive no mail

Status
Not open for further replies.

Trowser

IS-IT--Management
Dec 16, 2002
125
GB
Hi guys this is the Asp Code I amd using from a form in oder to send the forms results back to us by email

for some reason we have never recived an email back dunno if I have messed something up in the code could someone look over it for me please


<%@ CodePage=65001 Language=&quot;VBScript&quot;%>
<% Dim strFrom, strMember, strMemberID, strGuest, strArrive, StrLeave, StrPayment

'The header/footer for the email.
Const strHeader = &quot;Guest Registration Form Submitted:&quot;
Const strFooter = &quot;Form mailer created by BDB Productions, 2003&quot;

'Who does this go to?
Const strTo = &quot;powerhungry@enbassistant.com&quot;

'From Field
strFrom = Request.form(&quot;Email&quot;)

'Subject Field
Const strSubject = &quot;Guest Registration Request&quot;

'Member
strMember = Request.form(&quot;Member&quot;)

'Members ID
strMemberID = Request.form(&quot;MemberID&quot;)

'Guests
strGuest = Request.form (&quot;Guest&quot;)

'Guests Arrive at
strArrive = Request.form(&quot;Garr&quot;)

'Guest Leaves at
strLeave = Request.form(&quot;Gleave&quot;)

'Payment
strPayment = Request.form(&quot;Payment&quot;)

'Redirect
Const strRedirectURL = &quot;
Dim strBody
strBody = strHeader & ( vbCrLf & vbCrLf )
strBody = strBody & ( &quot;FORM submitted at &quot; & Now() & vbCrLf & vbCrLf )
strBody = strBody & ( &quot;Members Name: &quot; & strMember & vbCrLf & vbCrLF )
strBody = strBody & ( &quot;Members ID: &quot; & strMemberID & vbCrLf & vbCrLF )
strBody = StrBody & ( &quot;Guests Name: &quot; & strGuest & vbCrLf & vbCrLF )
strBody = strBody & ( &quot;Time of Arrival: &quot; & strArrive & vbCrLf & vbCrLF )
strBody = strBody & ( &quot;Time of Departure: &quot; & strLeave & vbCrLf & vbCrLF )
strBody = strBody & ( &quot;Payment Method: &quot; & strPayment & vbCrLf & vbCrLF )
strBody = StrBody & strFooter

'Time to send the email
Dim objCDO
Set objCDO = Server.CreateObject(&quot;CDONTS.NewMail&quot;)

objCDO.To = strTo
objCDO.From = strFrom
objCDO.Subject = strSubject
objCDO.Body = strBody

objCDO.Send

Set objCDO = Nothing

'Send them to the page specified
Response.Redirect strRedirectURL
%>
 
Trowser,
I can't see where the error is in your code however the following works on my site:

Set objMail = CreateObject(&quot;CDONTS.Newmail&quot;)
objMail.From = &quot;name@mysite.co.uk&quot;
objMail.To = &quot;name@theirsite.co.uk&quot;
objMail.Cc= &quot;name@anotherdomain.co.uk&quot;
objMail.Subject = &quot;A subject here&quot;
objMail.Body = Message
objMail.Send
Set objMail = Nothing

and obviously you could replace/concatenate any of the strings with your own variables.

Hope this helps,
Paul.
 
Actually, now looking at your code **I think*** it might be a problem with your quotes...

strFrom will contain a string

and

objCDO.From = strFrom

will be like doing

objCDO.From = name@yourdomain.com

when u really need

objCDO.From = &quot;name@yourdomain.com&quot;

so maybe need to try

objCDO.From = &quot;'&quot; & strFrom & &quot;'&quot;

but I'm not sure about single quotes with CDONT object!
 
yup mine looks the same Grrr it annoying me now :)
 
Thanks Atmo I will try it and see
 
atmospherik,

have you tried the same CodePage setting?
Code:
<%@ CodePage=65001 Language=&quot;VBScript&quot;%>

-pete
 
Have never heard of a CodePage!!!!

My page simply has <%Language=&quot;VBScript&quot;%>
 
ok I found the problem

Seems like I renamed MemberID to Member_ID (on the form page) so the var wasn't being passed and being picked up


Now since I am new to ASP but I do program VB I thought this would throw up an error but it doesn't something I am going to have to watch in the future.

Thanks for the input though lads
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top